[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-vercel-labs--coding-agent-template":3,"tool-vercel-labs--coding-agent-template":62},[4,18,26,36,46,54],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",159267,2,"2026-04-17T11:29:14",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":42,"last_commit_at":43,"category_tags":44,"status":17},8272,"opencode","anomalyco\u002Fopencode","OpenCode 是一款开源的 AI 编程助手（Coding Agent），旨在像一位智能搭档一样融入您的开发流程。它不仅仅是一个代码补全插件，而是一个能够理解项目上下文、自主规划任务并执行复杂编码操作的智能体。无论是生成全新功能、重构现有代码，还是排查难以定位的 Bug，OpenCode 都能通过自然语言交互高效完成，显著减少开发者在重复性劳动和上下文切换上的时间消耗。\n\n这款工具专为软件开发者、工程师及技术研究人员设计，特别适合希望利用大模型能力来提升编码效率、加速原型开发或处理遗留代码维护的专业人群。其核心亮点在于完全开源的架构，这意味着用户可以审查代码逻辑、自定义行为策略，甚至私有化部署以保障数据安全，彻底打破了传统闭源 AI 助手的“黑盒”限制。\n\n在技术体验上，OpenCode 提供了灵活的终端界面（Terminal UI）和正在测试中的桌面应用程序，支持 macOS、Windows 及 Linux 全平台。它兼容多种包管理工具，安装便捷，并能无缝集成到现有的开发环境中。无论您是追求极致控制权的资深极客，还是渴望提升产出的独立开发者，OpenCode 都提供了一个透明、可信",144296,1,"2026-04-16T14:50:03",[13,45],"插件",{"id":47,"name":48,"github_repo":49,"description_zh":50,"stars":51,"difficulty_score":32,"last_commit_at":52,"category_tags":53,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":55,"name":56,"github_repo":57,"description_zh":58,"stars":59,"difficulty_score":32,"last_commit_at":60,"category_tags":61,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[45,13,15,14],{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":78,"owner_twitter":79,"owner_website":80,"owner_url":81,"languages":82,"stars":95,"forks":96,"last_commit_at":97,"license":98,"difficulty_score":99,"env_os":100,"env_gpu":101,"env_ram":101,"env_deps":102,"category_tags":113,"github_topics":77,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":114,"updated_at":115,"faqs":116,"releases":143},8602,"vercel-labs\u002Fcoding-agent-template","coding-agent-template","Multi-agent AI coding platform powered by Vercel Sandbox and AI Gateway","coding-agent-template 是一个基于 Vercel Sandbox 和 AI Gateway 构建的多智能体 AI 编程平台模板。它旨在解决开发者在自动化执行代码任务时面临的环境配置复杂、多模型切换困难以及安全隔离不足等痛点。通过集成 Claude Code、OpenAI Codex、GitHub Copilot、Cursor 等多种主流 AI 编程工具，用户只需输入仓库链接和任务描述，即可在安全的隔离沙箱中自动完成代码生成、依赖安装及分支提交全流程。\n\n这款工具特别适合希望快速搭建私有化 AI 编程助手团队的开发者、技术负责人及开源项目维护者。其独特亮点在于原生支持 Vercel Sandbox，确保所有代码执行均在隔离环境中进行，保障安全性；同时内置 AI Gateway，可灵活路由不同大模型并监控调用情况。此外，它还具备自动生成语义化 Git 分支名、实时任务进度追踪以及多用户数据隔离等企业级功能。借助一键部署能力，配合 Next.js 与 Tailwind CSS 打造的现代化界面，团队能轻松拥有专属的智能化编码工作流，显著提升研发效率。","# Coding Agent Template\n\nA template for building AI-powered coding agents that supports Claude Code, OpenAI's Codex CLI, GitHub Copilot CLI, Cursor CLI, Google Gemini CLI, and opencode with [Vercel Sandbox](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fvercel-sandbox) to automatically execute coding tasks on your repositories.\n\n![Coding Agent Template Screenshot](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fvercel-labs_coding-agent-template_readme_cc327ebccb53.png)\n\n## Deploy Your Own\n\nYou can deploy your own version of the coding agent template to Vercel with one click:\n\n[![Deploy with Vercel](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fvercel-labs_coding-agent-template_readme_a4c0f8073a9c.png)](https:\u002F\u002Fvercel.com\u002Fnew\u002Fclone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel-labs%2Fcoding-agent-template&env=SANDBOX_VERCEL_TEAM_ID,SANDBOX_VERCEL_PROJECT_ID,SANDBOX_VERCEL_TOKEN,JWE_SECRET,ENCRYPTION_KEY&envDescription=Required+environment+variables+for+the+coding+agent+template.+You+must+also+configure+at+least+one+OAuth+provider+(GitHub+or+Vercel)+after+deployment.+Optional+API+keys+can+be+added+later.&stores=%5B%7B%22type%22%3A%22postgres%22%7D%5D&project-name=coding-agent-template&repository-name=coding-agent-template)\n\n**What happens during deployment:**\n- **Automatic Database Setup**: A Neon Postgres database is automatically created and connected to your project\n- **Environment Configuration**: You'll be prompted to provide required environment variables (Vercel credentials and encryption keys)\n- **OAuth Setup**: After deployment, you'll need to configure at least one OAuth provider (GitHub or Vercel) in your project settings for user authentication\n\n## Features\n\n- **Multi-Agent Support**: Choose from Claude Code, OpenAI Codex CLI, GitHub Copilot CLI, Cursor CLI, Google Gemini CLI, or opencode to execute coding tasks\n- **User Authentication**: Secure sign-in with GitHub or Vercel OAuth\n- **Multi-User Support**: Each user has their own tasks, API keys, and GitHub connection\n- **Vercel Sandbox**: Runs code in isolated, secure sandboxes ([docs](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fvercel-sandbox))\n- **AI Gateway Integration**: Built for seamless integration with [Vercel AI Gateway](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fai-gateway) for model routing and observability\n- **AI-Generated Branch Names**: Automatically generates descriptive Git branch names using AI SDK 5 + AI Gateway\n- **Task Management**: Track task progress with real-time updates\n- **Persistent Storage**: Tasks stored in Neon Postgres database\n- **Git Integration**: Automatically creates branches and commits changes\n- **Modern UI**: Clean, responsive interface built with Next.js and Tailwind CSS\n- **MCP Server Support**: Connect MCP servers to Claude Code for extended capabilities (Claude only)\n\n## Quick Start\n\nFor detailed setup instructions, see the [Local Development Setup](#local-development-setup) section below.\n\n**TL;DR:**\n1. Click the \"Deploy with Vercel\" button above (automatic database setup!)\n2. Configure OAuth (GitHub or Vercel) in your project settings\n3. Users sign in and start creating tasks\n\nOr run locally:\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fcoding-agent-template.git\ncd coding-agent-template\npnpm install\n# Set up .env.local with required variables\npnpm db:push\npnpm dev\n```\n\n## Usage\n\n1. **Sign In**: Authenticate with GitHub or Vercel\n2. **Create a Task**: Enter a repository URL and describe what you want the AI to do\n3. **Monitor Progress**: Watch real-time logs as the agent works\n4. **Review Results**: See the changes made and the branch created\n5. **Manage Tasks**: View all your tasks in the sidebar with status updates\n\n## Task Configuration\n\n### Maximum Duration\n\nThe maximum duration setting controls how long the Vercel sandbox will stay alive from the moment it's created. You can select timeouts ranging from 5 minutes to 5 hours.\n\n- The sandbox is created at the start of the task\n- The timeout begins when the sandbox is created\n- All work (agent execution, dependency installation, etc.) happens within this timeframe\n- When the timeout is reached, the sandbox automatically expires\n\n### Keep Alive Setting\n\nThe Keep Alive setting determines what happens to the sandbox after your task completes.\n\n#### Keep Alive OFF (Default)\n\nWhen Keep Alive is disabled, the sandbox shuts down immediately after the task completes:\n\n**Timeline:**\n1. Task starts and sandbox is created (e.g., with 1 hour timeout)\n2. Agent executes your task\n3. Task completes successfully (e.g., after 10 minutes)\n4. Changes are committed and pushed to the branch\n5. Sandbox immediately shuts down (destroys all processes and the environment)\n6. Task is marked as completed\n\n**Use Keep Alive OFF when:**\n- You're making one-time code changes that don't require iteration\n- You have simple tasks that work on the first try\n- You want to minimize resource usage and costs\n- You don't need to test or manually interact with the code after completion\n\n#### Keep Alive ON\n\nWhen Keep Alive is enabled, the sandbox stays alive after task completion for the remaining duration:\n\n**Timeline:**\n1. Task starts and sandbox is created (e.g., with 1 hour timeout)\n2. Agent executes your task\n3. Task completes successfully (e.g., after 10 minutes)\n4. Changes are committed and pushed to the branch\n5. Sandbox stays alive with all processes running\n6. You can send follow-up messages for 50 more minutes (until the 1 hour timeout expires)\n7. If the project has a dev server (e.g., `npm run dev`), it automatically starts in the background\n8. After the full timeout duration, the sandbox expires\n\n**Use Keep Alive ON when:**\n- You need to iterate on the code with follow-up messages\n- You want to test changes in the live sandbox environment\n- You anticipate needing to refine or fix issues\n- You want to manually run commands or inspect the environment after completion\n- You're developing a web application and want to see it running\n\n#### Comparison\n\n| Setting | Task completes in 10 min | Remaining sandbox time | Can send follow-ups? | Dev server starts? |\n|---------|-------------------------|------------------------|---------------------|-------------------|\n| Keep Alive ON | Sandbox stays alive | 50 minutes (until timeout) | Yes | Yes (if available) |\n| Keep Alive OFF | Sandbox shuts down | 0 minutes | No | No |\n\n**Note:** The maximum duration timeout always takes precedence. If you set a 1-hour timeout, the sandbox will expire after 1 hour regardless of the Keep Alive setting. Keep Alive only determines whether the sandbox shuts down early (after task completion) or stays alive until the timeout.\n\n## How It Works\n\n1. **Task Creation**: When you submit a task, it's stored in the database\n2. **AI Branch Name Generation**: AI SDK 5 + AI Gateway automatically generates a descriptive branch name based on your task (non-blocking using Next.js 15's `after()`)\n3. **Sandbox Setup**: A Vercel sandbox is created with your repository\n4. **Agent Execution**: Your chosen coding agent (Claude Code, Codex CLI, GitHub Copilot CLI, Cursor CLI, Gemini CLI, or opencode) analyzes your prompt and makes changes\n5. **Git Operations**: Changes are committed and pushed to the AI-generated branch\n6. **Cleanup**: The sandbox is shut down to free resources\n\n## AI Branch Name Generation\n\nThe system automatically generates descriptive Git branch names using AI SDK 5 and Vercel AI Gateway. This feature:\n\n- **Non-blocking**: Uses Next.js 15's `after()` function to generate names without delaying task creation\n- **Descriptive**: Creates meaningful branch names like `feature\u002Fuser-authentication-A1b2C3` or `fix\u002Fmemory-leak-parser-X9y8Z7`\n- **Conflict-free**: Adds a 6-character alphanumeric hash to prevent naming conflicts\n- **Fallback**: Gracefully falls back to timestamp-based names if AI generation fails\n- **Context-aware**: Uses task description, repository name, and agent context for better names\n\n### Branch Name Examples\n\n- `feature\u002Fadd-user-auth-K3mP9n` (for \"Add user authentication with JWT\")\n- `fix\u002Fresolve-memory-leak-B7xQ2w` (for \"Fix memory leak in image processing\")\n- `chore\u002Fupdate-deps-M4nR8s` (for \"Update all project dependencies\")\n- `docs\u002Fapi-endpoints-F9tL5v` (for \"Document REST API endpoints\")\n\n## Tech Stack\n\n- **Frontend**: Next.js 15, React 19, Tailwind CSS\n- **UI Components**: shadcn\u002Fui\n- **Database**: PostgreSQL with Drizzle ORM\n- **AI SDK**: AI SDK 5 with Vercel AI Gateway integration\n- **AI Agents**: Claude Code, OpenAI Codex CLI, GitHub Copilot CLI, Cursor CLI, Google Gemini CLI, opencode\n- **Sandbox**: [Vercel Sandbox](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fvercel-sandbox)\n- **Authentication**: Next Auth (OAuth with GitHub\u002FVercel)\n- **Git**: Automated branching and commits with AI-generated branch names\n\n## MCP Server Support\n\nConnect MCP Servers to extend Claude Code with additional tools and integrations. **Currently only works with Claude Code agent.**\n\n### How to Add MCP Servers\n\n1. Go to the \"Connectors\" tab and click \"Add MCP Server\"\n2. Enter server details (name, base URL, optional OAuth credentials)\n3. If using OAuth, ensure `ENCRYPTION_KEY` is set in your environment variables\n\n**Note**: `ENCRYPTION_KEY` is required when using MCP servers with OAuth authentication.\n\n## Local Development Setup\n\n### 1. Clone the repository\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fcoding-agent-template.git\ncd coding-agent-template\n```\n\n### 2. Install dependencies\n\n```bash\npnpm install\n```\n\n### 3. Set up environment variables\n\nCreate a `.env.local` file with your values:\n\n#### Required Environment Variables (App Infrastructure)\n\nThese are set once by you (the app developer) and are used for core infrastructure:\n\n- `POSTGRES_URL`: Your PostgreSQL connection string (automatically provided when deploying to Vercel via the Neon integration, or set manually for local development)\n- `SANDBOX_VERCEL_TOKEN`: Your Vercel API token (for creating sandboxes)\n- `SANDBOX_VERCEL_TEAM_ID`: Your Vercel team ID (for sandbox creation)\n- `SANDBOX_VERCEL_PROJECT_ID`: Your Vercel project ID (for sandbox creation)\n- `JWE_SECRET`: Base64-encoded secret for session encryption (generate with: `openssl rand -base64 32`)\n- `ENCRYPTION_KEY`: 32-byte hex string for encrypting user API keys and tokens (generate with: `openssl rand -hex 32`)\n\n> **Note**: When deploying to Vercel using the \"Deploy with Vercel\" button, the database is automatically provisioned via Neon and `POSTGRES_URL` is set for you. For local development, you'll need to provide your own database connection string.\n\n#### User Authentication (Required)\n\n**You must configure at least one authentication method** (Vercel or GitHub):\n\n##### Configure Enabled Providers\n\n- `NEXT_PUBLIC_AUTH_PROVIDERS`: Comma-separated list of enabled auth providers\n  - `\"github\"` - GitHub only (default)\n  - `\"vercel\"` - Vercel only\n  - `\"github,vercel\"` - Both providers enabled\n\n**Examples:**\n\n```bash\n# GitHub authentication only (default)\nNEXT_PUBLIC_AUTH_PROVIDERS=github\n\n# Vercel authentication only\nNEXT_PUBLIC_AUTH_PROVIDERS=vercel\n\n# Both GitHub and Vercel authentication\nNEXT_PUBLIC_AUTH_PROVIDERS=github,vercel\n```\n\n##### Provider Configuration\n\n**Option 1: Sign in with Vercel** (if `vercel` is in `NEXT_PUBLIC_AUTH_PROVIDERS`)\n- `NEXT_PUBLIC_VERCEL_CLIENT_ID`: Your Vercel OAuth app client ID (exposed to client)\n- `VERCEL_CLIENT_SECRET`: Your Vercel OAuth app client secret\n\n**Option 2: Sign in with GitHub** (if `github` is in `NEXT_PUBLIC_AUTH_PROVIDERS`)\n- `NEXT_PUBLIC_GITHUB_CLIENT_ID`: Your GitHub OAuth app client ID (exposed to client)\n- `GITHUB_CLIENT_SECRET`: Your GitHub OAuth app client secret\n\n> **Note**: Only the providers listed in `NEXT_PUBLIC_AUTH_PROVIDERS` will appear in the sign-in dialog. You must provide the OAuth credentials for each enabled provider.\n\n#### API Keys (Optional - Can be per-user)\n\nThese API keys can be set globally (fallback for all users) or left unset to require users to provide their own:\n\n- `ANTHROPIC_API_KEY`: Anthropic API key for Claude agent (users can override in their profile)\n- `AI_GATEWAY_API_KEY`: AI Gateway API key for branch name generation and Codex (users can override)\n- `CURSOR_API_KEY`: For Cursor agent support (users can override)\n- `GEMINI_API_KEY`: For Google Gemini agent support (users can override)\n- `OPENAI_API_KEY`: For Codex and OpenCode agents (users can override)\n\n> **Note**: Users can provide their own API keys in their profile settings, which take precedence over global environment variables.\n\n#### GitHub Repository Access\n\n- ~~`GITHUB_TOKEN`~~: **No longer needed!** Users authenticate with their own GitHub accounts.\n  - Users who sign in with GitHub automatically get repository access via their OAuth token\n  - Users who sign in with Vercel can connect their GitHub account from their profile to access repositories\n\n**How Authentication Works:**\n- **Sign in with GitHub**: Users get immediate repository access via their GitHub OAuth token\n- **Sign in with Vercel**: Users must connect a GitHub account from their profile to work with repositories\n- **Identity Merging**: If a user signs in with Vercel, connects GitHub, then later signs in directly with GitHub, they'll be recognized as the same user (no duplicate accounts)\n\n#### Optional Environment Variables\n\n- `NPM_TOKEN`: For private npm packages\n- `MAX_SANDBOX_DURATION`: Default maximum sandbox duration in minutes (default: `300` = 5 hours)\n- `MAX_MESSAGES_PER_DAY`: Maximum number of tasks + follow-ups per user per day (default: `5`)\n\n### 4. Set up OAuth Applications\n\nBased on your `NEXT_PUBLIC_AUTH_PROVIDERS` configuration, you'll need to create OAuth apps:\n\n#### GitHub OAuth App (if using GitHub authentication)\n\n1. Go to [GitHub Developer Settings](https:\u002F\u002Fgithub.com\u002Fsettings\u002Fdevelopers)\n2. Click \"New OAuth App\"\n3. Fill in the details:\n   - **Application name**: Your app name (e.g., \"My Coding Agent\")\n   - **Homepage URL**: `http:\u002F\u002Flocalhost:3000` (or your production URL)\n   - **Authorization callback URL**: `http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fauth\u002Fgithub\u002Fcallback`\n4. Click \"Register application\"\n5. Copy the **Client ID** → use for `NEXT_PUBLIC_GITHUB_CLIENT_ID`\n6. Click \"Generate a new client secret\" → copy and use for `GITHUB_CLIENT_SECRET`\n\n**Required Scopes**: The app will request `repo` scope to access repositories.\n\n#### Vercel OAuth App (if using Vercel authentication)\n\n1. Go to your [Vercel Dashboard](https:\u002F\u002Fvercel.com\u002Fdashboard)\n2. Navigate to Settings → Integrations → Create\n3. Configure the integration:\n   - **Redirect URL**: `http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fauth\u002Fcallback\u002Fvercel`\n4. Copy the **Client ID** → use for `NEXT_PUBLIC_VERCEL_CLIENT_ID`\n5. Copy the **Client Secret** → use for `VERCEL_CLIENT_SECRET`\n\n> **Production Deployment**: Remember to add production callback URLs when deploying (e.g., `https:\u002F\u002Fyourdomain.com\u002Fapi\u002Fauth\u002Fgithub\u002Fcallback`)\n\n### 5. Set up the database\n\nGenerate and run database migrations:\n\n```bash\npnpm db:generate\npnpm db:push\n```\n\n### 6. Start the development server\n\n```bash\npnpm dev\n```\n\nOpen [http:\u002F\u002Flocalhost:3000](http:\u002F\u002Flocalhost:3000) in your browser.\n\n## Development\n\n### Database Operations\n\n```bash\n# Generate migrations\npnpm db:generate\n\n# Push schema changes\npnpm db:push\n\n# Open Drizzle Studio\npnpm db:studio\n```\n\n### Running the App\n\n```bash\n# Development\npnpm dev\n\n# Build for production\npnpm build\n\n# Start production server\npnpm start\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Test thoroughly\n5. Submit a pull request\n\n## Security Considerations\n\n- **Environment Variables**: Never commit `.env` files to version control. All sensitive data should be stored in environment variables.\n- **API Keys**: Rotate your API keys regularly and use the principle of least privilege.\n- **Database Access**: Ensure your PostgreSQL database is properly secured with strong credentials.\n- **Vercel Sandbox**: Sandboxes are isolated but ensure you're not exposing sensitive data in logs or outputs.\n- **User Authentication**: Each user uses their own GitHub token for repository access - no shared credentials\n- **Encryption**: All sensitive data (tokens, API keys) is encrypted at rest using per-user encryption\n\n## Changelog\n\n### Version 2.0.0 - Major Update: User Authentication & Security\n\nThis release introduces **user authentication** and **major security improvements**, but contains **breaking changes** that require migration for existing deployments.\n\n#### New Features\n\n- **User Authentication System**\n  - Sign in with Vercel\n  - Sign in with GitHub\n  - Session management with encrypted tokens\n  - User profile management\n\n- **Multi-User Support**\n  - Each user has their own tasks and connectors\n  - Users can manage their own API keys (Anthropic, OpenAI, Cursor, Gemini, AI Gateway)\n  - GitHub account connection for repository access\n\n- **Security Enhancements**\n  - Per-user GitHub authentication - each user uses their own GitHub token instead of shared credentials\n  - All sensitive data (tokens, API keys, env vars) encrypted at rest\n  - Session-based authentication with JWT encryption\n  - User-scoped authorization - users can only access their own resources\n\n- **Database Enhancements**\n  - New `users` table for user profiles and OAuth accounts\n  - New `accounts` table for linked accounts (e.g., Vercel users connecting GitHub)\n  - New `keys` table for user-provided API keys\n  - Foreign key relationships ensure data integrity\n  - Soft delete support for tasks\n\n#### Breaking Changes\n\n**These changes require action if upgrading from v1.x:**\n\n1. **Database Schema Changes**\n   - `tasks` table now requires `userId` (foreign key to `users.id`)\n   - `connectors` table now requires `userId` (foreign key to `users.id`)\n   - `connectors.env` changed from `jsonb` to encrypted `text`\n   - Added `tasks.deletedAt` for soft deletes\n\n2. **API Changes**\n   - All API endpoints now require authentication\n   - Task creation requires `userId` in request body\n   - Tasks are now filtered by user ownership\n   - GitHub API access uses user's own GitHub token (no shared token fallback)\n\n3. **Environment Variables**\n   - **New Required Variables:**\n     - `JWE_SECRET`: Base64-encoded secret for session encryption (generate: `openssl rand -base64 32`)\n     - `ENCRYPTION_KEY`: 32-byte hex string for encrypting sensitive data (generate: `openssl rand -hex 32`)\n     - `NEXT_PUBLIC_AUTH_PROVIDERS`: Configure which auth providers to enable (`github`, `vercel`, or both)\n   \n   - **New OAuth Configuration (at least one required):**\n     - GitHub: `NEXT_PUBLIC_GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`\n     - Vercel: `NEXT_PUBLIC_VERCEL_CLIENT_ID`, `VERCEL_CLIENT_SECRET`\n   \n   - **Changed Authentication:**\n     - `GITHUB_TOKEN` no longer used as fallback in API routes\n     - Users must connect their own GitHub account for repository access\n     - Each user's GitHub token is used for their requests\n\n4. **Authentication Required**\n   - All routes now require user authentication\n   - No anonymous access to tasks or API endpoints\n   - Users must sign in with GitHub or Vercel before creating tasks\n\n#### Migration Guide for Existing Deployments\n\nIf you're upgrading from v1.x to v2.0.0, follow these steps:\n\n##### Step 1: Backup Your Database\n\n```bash\n# Create a backup of your existing database\npg_dump $POSTGRES_URL > backup-before-v2-migration.sql\n```\n\n##### Step 2: Add Required Environment Variables\n\nAdd these new variables to your `.env.local` or Vercel project settings:\n\n```bash\n# Session encryption (REQUIRED)\nJWE_SECRET=$(openssl rand -base64 32)\nENCRYPTION_KEY=$(openssl rand -hex 32)\n\n# Configure auth providers (REQUIRED - choose at least one)\nNEXT_PUBLIC_AUTH_PROVIDERS=github  # or \"vercel\" or \"github,vercel\"\n\n# GitHub OAuth (if using GitHub authentication)\nNEXT_PUBLIC_GITHUB_CLIENT_ID=your_github_client_id\nGITHUB_CLIENT_SECRET=your_github_client_secret\n\n# Vercel OAuth (if using Vercel authentication)\nNEXT_PUBLIC_VERCEL_CLIENT_ID=your_vercel_client_id\nVERCEL_CLIENT_SECRET=your_vercel_client_secret\n```\n\n##### Step 3: Set Up OAuth Applications\n\nCreate OAuth applications for your chosen authentication provider(s). See the [Local Development Setup](#local-development-setup) section for detailed instructions.\n\n##### Step 4: Prepare Database Migration\n\nBefore running migrations, you need to handle existing data:\n\n**Option A: Fresh Start (Recommended for Development)**\n\nIf you don't have production data to preserve:\n\n```bash\n# Drop existing tables and start fresh\npnpm db:push --force\n\n# This will create all new tables with proper structure\n```\n\n**Option B: Preserve Existing Data (Production)**\n\nIf you have existing tasks\u002Fconnectors to preserve:\n\n1. **Create a system user first:**\n\n```sql\n-- Connect to your database and run:\nINSERT INTO users (id, provider, external_id, access_token, username, email, created_at, updated_at, last_login_at)\nVALUES (\n  'system-user-migration',\n  'github',\n  'system-migration',\n  'encrypted-placeholder-token',  -- You'll need to encrypt a placeholder\n  'System Migration User',\n  NULL,\n  NOW(),\n  NOW(),\n  NOW()\n);\n```\n\n2. **Update existing records:**\n\n```sql\n-- Add userId to existing tasks\nALTER TABLE tasks ADD COLUMN user_id TEXT;\nUPDATE tasks SET user_id = 'system-user-migration' WHERE user_id IS NULL;\nALTER TABLE tasks ALTER COLUMN user_id SET NOT NULL;\nALTER TABLE tasks ADD CONSTRAINT tasks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;\n\n-- Add userId to existing connectors\nALTER TABLE connectors ADD COLUMN user_id TEXT;\nUPDATE connectors SET user_id = 'system-user-migration' WHERE user_id IS NULL;\nALTER TABLE connectors ALTER COLUMN user_id SET NOT NULL;\nALTER TABLE connectors ADD CONSTRAINT connectors_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;\n\n-- Convert connector env from jsonb to encrypted text (requires app-level encryption)\n-- Note: You'll need to manually encrypt existing env values using your ENCRYPTION_KEY\n```\n\n3. **Run the standard migrations:**\n\n```bash\npnpm db:generate\npnpm db:push\n```\n\n##### Step 5: Update Your Code\n\nPull the latest changes:\n\n```bash\ngit pull origin main\npnpm install\n```\n\n##### Step 6: Test Authentication\n\n1. Start the development server: `pnpm dev`\n2. Navigate to `http:\u002F\u002Flocalhost:3000`\n3. Sign in with your configured OAuth provider\n4. Verify you can create and view tasks\n\n##### Step 7: Verify Security Fix\n\nConfirm that:\n- Users can only see their own tasks\n- File diff\u002Ffiles endpoints require GitHub connection\n- Users without GitHub connection see \"GitHub authentication required\" errors\n- No `GITHUB_TOKEN` fallback is being used in API routes\n\n#### Important Notes\n\n- **All users will need to sign in** after this upgrade - no anonymous access\n- **Existing tasks** will be owned by the system user if using Option B migration\n- **Users must connect GitHub** (if they signed in with Vercel) to access repositories\n- **API keys** can now be per-user - users can override global API keys in their profile\n- **Breaking API changes**: If you have external integrations calling your API, they'll need to be updated to include authentication\n\n","# 编码代理模板\n\n这是一个用于构建 AI 驱动编码代理的模板，支持 Claude Code、OpenAI 的 Codex CLI、GitHub Copilot CLI、Cursor CLI、Google Gemini CLI 以及 opencode，并结合 [Vercel Sandbox](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fvercel-sandbox) 自动在您的代码库上执行编码任务。\n\n![编码代理模板截图](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fvercel-labs_coding-agent-template_readme_cc327ebccb53.png)\n\n## 部署您自己的版本\n\n您可以一键将编码代理模板部署到 Vercel：\n\n[![使用 Vercel 部署](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fvercel-labs_coding-agent-template_readme_a4c0f8073a9c.png)](https:\u002F\u002Fvercel.com\u002Fnew\u002Fclone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel-labs%2Fcoding-agent-template&env=SANDBOX_VERCEL_TEAM_ID,SANDBOX_VERCEL_PROJECT_ID,SANDBOX_VERCEL_TOKEN,JWE_SECRET,ENCRYPTION_KEY&envDescription=Required+environment+variables+for+the+coding+agent+template.+You+must+also+configure+at+least+one+OAuth+provider+(GitHub+or+Vercel)+after+deployment.+Optional+API+keys+can+be+added+later.&stores=%5B%7B%22type%22%3A%22postgres%22%7D%5D&project-name=coding-agent-template&repository-name=coding-agent-template)\n\n**部署过程中会发生什么：**\n- **自动数据库设置**：会自动创建一个 Neon Postgres 数据库并连接到您的项目。\n- **环境变量配置**：系统会提示您提供所需的环境变量（Vercel 凭证和加密密钥）。\n- **OAuth 设置**：部署完成后，您需要在项目设置中配置至少一个 OAuth 提供者（GitHub 或 Vercel），以便进行用户身份验证。\n\n## 功能特性\n\n- **多代理支持**：可选择 Claude Code、OpenAI Codex CLI、GitHub Copilot CLI、Cursor CLI、Google Gemini CLI 或 opencode 来执行编码任务。\n- **用户身份验证**：通过 GitHub 或 Vercel OAuth 安全登录。\n- **多用户支持**：每个用户拥有独立的任务、API 密钥和 GitHub 连接。\n- **Vercel Sandbox**：在隔离且安全的沙盒中运行代码（[文档](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fvercel-sandbox)）。\n- **AI 网关集成**：专为与 [Vercel AI 网关](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fai-gateway) 无缝集成而设计，实现模型路由和可观性。\n- **AI 生成分支名称**：利用 AI SDK 5 和 AI 网关自动生成描述性的 Git 分支名称。\n- **任务管理**：实时更新任务进度。\n- **持久化存储**：任务存储在 Neon Postgres 数据库中。\n- **Git 集成**：自动创建分支并提交更改。\n- **现代化 UI**：采用 Next.js 和 Tailwind CSS 构建的简洁、响应式界面。\n- **MCP 服务器支持**：可将 MCP 服务器连接到 Claude Code，以扩展功能（仅限 Claude）。\n\n## 快速入门\n\n有关详细的设置说明，请参阅下方的 [本地开发设置](#local-development-setup) 部分。\n\n**简而言之：**\n1. 点击上方的“使用 Vercel 部署”按钮（自动设置数据库！）\n2. 在项目设置中配置 OAuth（GitHub 或 Vercel）。\n3. 用户登录并开始创建任务。\n\n或者在本地运行：\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fcoding-agent-template.git\ncd coding-agent-template\npnpm install\n# 设置 .env.local 文件，填入所需变量\npnpm db:push\npnpm dev\n```\n\n## 使用方法\n\n1. **登录**：使用 GitHub 或 Vercel 进行身份验证。\n2. **创建任务**：输入代码库 URL 并描述您希望 AI 执行的操作。\n3. **监控进度**：查看代理执行过程中的实时日志。\n4. **审查结果**：查看所做的更改及创建的分支。\n5. **管理任务**：在侧边栏中查看所有任务及其状态更新。\n\n## 任务配置\n\n### 最大时长\n\n最大时长设置控制着 Vercel 沙盒从创建时刻起保持活跃的时间长度。您可以选择从 5 分钟到 5 小时不等的超时时间。\n\n- 沙盒在任务开始时创建。\n- 超时计时从沙盒创建时开始。\n- 所有工作（代理执行、依赖项安装等）都在此时间内完成。\n- 当达到超时时长时，沙盒会自动过期。\n\n### 保持活跃设置\n\n“保持活跃”设置决定了任务完成后沙盒的后续行为。\n\n#### 保持活跃关闭（默认）\n\n当“保持活跃”关闭时，沙盒会在任务完成后立即关闭：\n\n**时间线：**\n1. 任务开始，沙盒创建（例如，设置 1 小时超时）。\n2. 代理执行您的任务。\n3. 任务成功完成（例如，10 分钟后）。\n4. 更改被提交并推送到分支。\n5. 沙盒立即关闭（销毁所有进程和环境）。\n6. 任务标记为已完成。\n\n**建议在以下情况下关闭“保持活跃”：**\n- 您只需进行一次性代码更改，无需迭代。\n- 您的任务简单且一次就能完成。\n- 您希望最大限度地减少资源使用和成本。\n- 您不需要在任务完成后对代码进行测试或手动交互。\n\n#### 保持活跃开启\n\n当“保持活跃”开启时，沙盒会在任务完成后继续存活剩余时间：\n\n**时间线：**\n1. 任务开始，沙盒创建（例如，设置 1 小时超时）。\n2. 代理执行您的任务。\n3. 任务成功完成（例如，10 分钟后）。\n4. 更改被提交并推送到分支。\n5. 沙盒保持活跃，所有进程仍在运行。\n6. 您可以在接下来的 50 分钟内发送后续消息（直到 1 小时超时结束）。\n7. 如果项目中有开发服务器（例如 `npm run dev`），它会自动在后台启动。\n8. 达到完整超时时长后，沙盒过期。\n\n**建议在以下情况下开启“保持活跃”：**\n- 您需要通过后续消息对代码进行迭代。\n- 您希望在实时沙盒环境中测试更改。\n- 您预计可能需要进一步优化或修复问题。\n- 您希望在任务完成后手动运行命令或检查环境。\n- 您正在开发 Web 应用程序，并希望看到其运行效果。\n\n#### 对比\n\n| 设置         | 任务完成时间为 10 分钟 | 沙盒剩余时间 | 是否可以发送后续消息？ | 开发服务器是否启动？ |\n|--------------|-------------------------|--------------|-----------------------|---------------------|\n| 保持活跃开启 | 沙盒保持活跃           | 50 分钟（直至超时） | 是                   | 是（如有可用）     |\n| 保持活跃关闭 | 沙盒立即关闭          | 0 分钟       | 否                   | 否                  |\n\n**注意：** 最大时长超时始终优先。如果您设置了 1 小时超时，无论“保持活跃”设置如何，沙盒都将在 1 小时后过期。因此，“保持活跃”仅决定沙盒是在任务完成后提前关闭，还是在超时前继续保持活跃。\n\n## 工作原理\n\n1. **任务创建**：当你提交一个任务时，它会被存储在数据库中。\n2. **AI 分支名称生成**：AI SDK 5 + AI Gateway 会根据你的任务自动生成一个描述性的分支名称（使用 Next.js 15 的 `after()` 实现非阻塞操作）。\n3. **沙盒设置**：系统会基于你的仓库创建一个 Vercel 沙盒。\n4. **代理执行**：你选择的编码代理（Claude Code、Codex CLI、GitHub Copilot CLI、Cursor CLI、Gemini CLI 或 opencode）会分析你的提示并进行更改。\n5. **Git 操作**：更改会被提交并推送到由 AI 生成的分支上。\n6. **清理**：沙盒会被关闭以释放资源。\n\n## AI 分支名称生成\n\n系统会使用 AI SDK 5 和 Vercel AI Gateway 自动为 Git 分支生成描述性名称。该功能具有以下特点：\n\n- **非阻塞**：利用 Next.js 15 的 `after()` 函数生成分支名称，不会延迟任务创建。\n- **描述性强**：能够生成如 `feature\u002Fuser-authentication-A1b2C3` 或 `fix\u002Fmemory-leak-parser-X9y8Z7` 等有意义的分支名称。\n- **无冲突**：通过添加 6 位字母数字哈希值来避免命名冲突。\n- **回退机制**：如果 AI 生成失败，会优雅地回退到基于时间戳的名称。\n- **上下文感知**：结合任务描述、仓库名称和代理上下文，生成更优质的分支名称。\n\n### 分支名称示例\n\n- `feature\u002Fadd-user-auth-K3mP9n`（用于“添加 JWT 用户认证”）\n- `fix\u002Fresolve-memory-leak-B7xQ2w`（用于“修复图像处理中的内存泄漏”）\n- `chore\u002Fupdate-deps-M4nR8s`（用于“更新所有项目依赖”）\n- `docs\u002Fapi-endpoints-F9tL5v`（用于“记录 REST API 端点”）\n\n## 技术栈\n\n- **前端**：Next.js 15、React 19、Tailwind CSS\n- **UI 组件**：shadcn\u002Fui\n- **数据库**：PostgreSQL 结合 Drizzle ORM\n- **AI SDK**：AI SDK 5，集成 Vercel AI Gateway\n- **AI 代理**：Claude Code、OpenAI Codex CLI、GitHub Copilot CLI、Cursor CLI、Google Gemini CLI、opencode\n- **沙盒**：[Vercel 沙盒](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fvercel-sandbox)\n- **认证**：Next Auth（支持 GitHub\u002FVercel 的 OAuth 认证）\n- **Git**：自动化分支与提交，采用 AI 生成的分支名称。\n\n## MCP 服务器支持\n\n连接 MCP 服务器可以扩展 Claude Code 的工具和集成能力。**目前仅支持 Claude Code 代理。**\n\n### 如何添加 MCP 服务器\n\n1. 进入“Connectors”选项卡，点击“Add MCP Server”。\n2. 输入服务器详细信息（名称、基础 URL，可选 OAuth 凭证）。\n3. 如果使用 OAuth，请确保在环境变量中设置了 `ENCRYPTION_KEY`。\n\n**注意**：当使用带有 OAuth 认证的 MCP 服务器时，`ENCRYPTION_KEY` 是必需的。\n\n## 本地开发设置\n\n### 1. 克隆仓库\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fcoding-agent-template.git\ncd coding-agent-template\n```\n\n### 2. 安装依赖\n\n```bash\npnpm install\n```\n\n### 3. 设置环境变量\n\n创建一个 `.env.local` 文件，并填写你的配置：\n\n#### 必需环境变量（应用基础设施）\n\n这些变量由你（应用开发者）一次性设置，用于核心基础设施：\n\n- `POSTGRES_URL`：你的 PostgreSQL 连接字符串（部署到 Vercel 时，Neon 集成会自动提供；本地开发则需手动设置）。\n- `SANDBOX_VERCEL_TOKEN`：你的 Vercel API 令牌（用于创建沙盒）。\n- `SANDBOX_VERCEL_TEAM_ID`：你的 Vercel 团队 ID（用于沙盒创建）。\n- `SANDBOX_VERCEL_PROJECT_ID`：你的 Vercel 项目 ID（用于沙盒创建）。\n- `JWE_SECRET`：用于会话加密的 Base64 编码密钥（可通过命令 `openssl rand -base64 32` 生成）。\n- `ENCRYPTION_KEY`：用于加密用户 API 密钥和令牌的 32 字节十六进制字符串（可通过命令 `openssl rand -hex 32` 生成）。\n\n> **注意**：使用“Deploy with Vercel”按钮部署时，数据库会通过 Neon 自动 provision，`POSTGRES_URL` 也会为你设置好。而在本地开发环境中，则需要你自行提供数据库连接字符串。\n\n#### 用户认证（必填）\n\n**必须至少配置一种认证方式**（Vercel 或 GitHub）：\n\n##### 配置启用的提供商\n\n- `NEXT_PUBLIC_AUTH_PROVIDERS`：启用的认证提供商列表，用逗号分隔。\n  - `\"github\"`：仅 GitHub（默认）。\n  - `\"vercel\"`：仅 Vercel。\n  - `\"github,vercel\"`：同时启用两种认证方式。\n\n**示例：**\n\n```bash\n# 仅 GitHub 认证（默认）\nNEXT_PUBLIC_AUTH_PROVIDERS=github\n\n# 仅 Vercel 认证\nNEXT_PUBLIC_AUTH_PROVIDERS=vercel\n\n# 同时启用 GitHub 和 Vercel 认证\nNEXT_PUBLIC_AUTH_PROVIDERS=github,vercel\n```\n\n##### 提供商配置\n\n**选项 1：使用 Vercel 登录**（若 `vercel` 在 `NEXT_PUBLIC_AUTH_PROVIDERS` 中）：\n- `NEXT_PUBLIC_VERCEL_CLIENT_ID`：你的 Vercel OAuth 应用客户端 ID（暴露给客户端）。\n- `VERCEL_CLIENT_SECRET`：你的 Vercel OAuth 应用客户端密钥。\n\n**选项 2：使用 GitHub 登录**（若 `github` 在 `NEXT_PUBLIC_AUTH_PROVIDERS` 中）：\n- `NEXT_PUBLIC_GITHUB_CLIENT_ID`：你的 GitHub OAuth 应用客户端 ID（暴露给客户端）。\n- `GITHUB_CLIENT_SECRET`：你的 GitHub OAuth 应用客户端密钥。\n\n> **注意**：只有在 `NEXT_PUBLIC_AUTH_PROVIDERS` 中列出的提供商才会出现在登录对话框中。对于每个启用的提供商，你都必须提供相应的 OAuth 凭证。\n\n#### API 密钥（可选，可按用户设置）\n\n这些 API 密钥可以全局设置（作为所有用户的默认值），也可以不设置，从而要求用户各自提供自己的密钥：\n\n- `ANTHROPIC_API_KEY`：Claude 代理的 Anthropic API 密钥（用户可在个人资料中覆盖）。\n- `AI_GATEWAY_API_KEY`：用于分支名称生成和 Codex 的 AI Gateway API 密钥（用户可在个人资料中覆盖）。\n- `CURSOR_API_KEY`：用于 Cursor 代理的支持（用户可在个人资料中覆盖）。\n- `GEMINI_API_KEY`：用于 Google Gemini 代理的支持（用户可在个人资料中覆盖）。\n- `OPENAI_API_KEY`：用于 Codex 和 OpenCode 代理的支持（用户可在个人资料中覆盖）。\n\n> **注意**：用户可以在个人资料中提供自己的 API 密钥，这些密钥将优先于全局环境变量。\n\n#### GitHub 仓库访问权限\n\n- ~~`GITHUB_TOKEN`~~：**已不再需要！** 用户现在通过自己的 GitHub 账户进行认证。\n  - 使用 GitHub 登录的用户会通过其 OAuth 令牌直接获得仓库访问权限。\n  - 使用 Vercel 登录的用户则需要在个人资料中绑定 GitHub 账户，才能访问仓库。\n\n**认证工作原理：**\n- **GitHub 登录**：用户通过其 GitHub OAuth 令牌立即获得仓库访问权限。\n- **Vercel 登录**：用户需在个人资料中绑定 GitHub 账户，方可操作仓库。\n- **身份合并**：如果用户先使用 Vercel 登录，随后绑定 GitHub 账户，再直接使用 GitHub 登录，系统会识别为同一用户，不会产生重复账户。\n\n#### 可选环境变量\n\n- `NPM_TOKEN`：用于私有 npm 包。\n- `MAX_SANDBOX_DURATION`：沙盒的最大运行时长（分钟），默认为 `300` 分钟（即 5 小时）。\n- `MAX_MESSAGES_PER_DAY`：每位用户每天允许的最大任务数及后续跟进次数，默认为 `5`。\n\n### 4. 设置 OAuth 应用程序\n\n根据你的 `NEXT_PUBLIC_AUTH_PROVIDERS` 配置，你需要创建 OAuth 应用程序：\n\n#### GitHub OAuth 应用程序（如果使用 GitHub 身份验证）\n\n1. 前往 [GitHub 开发者设置](https:\u002F\u002Fgithub.com\u002Fsettings\u002Fdevelopers)\n2. 点击“新建 OAuth 应用”\n3. 填写详细信息：\n   - **应用名称**：你的应用名称（例如：“我的编码助手”）\n   - **主页 URL**：`http:\u002F\u002Flocalhost:3000`（或你的生产环境 URL）\n   - **授权回调 URL**：`http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fauth\u002Fgithub\u002Fcallback`\n4. 点击“注册应用”\n5. 复制 **客户端 ID** → 用于 `NEXT_PUBLIC_GITHUB_CLIENT_ID`\n6. 点击“生成新的客户端密钥”→ 复制并用于 `GITHUB_CLIENT_SECRET`\n\n**所需作用域**：该应用将请求 `repo` 作用域以访问仓库。\n\n#### Vercel OAuth 应用程序（如果使用 Vercel 身份验证）\n\n1. 前往你的 [Vercel 控制台](https:\u002F\u002Fvercel.com\u002Fdashboard)\n2. 导航到设置 → 集成 → 创建\n3. 配置集成：\n   - **重定向 URL**：`http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fauth\u002Fcallback\u002Fvercel`\n4. 复制 **客户端 ID** → 用于 `NEXT_PUBLIC_VERCEL_CLIENT_ID`\n5. 复制 **客户端密钥** → 用于 `VERCEL_CLIENT_SECRET`\n\n> **生产部署**：记得在部署时添加生产环境的回调 URL（例如：`https:\u002F\u002Fyourdomain.com\u002Fapi\u002Fauth\u002Fgithub\u002Fcallback`）\n\n### 5. 设置数据库\n\n生成并运行数据库迁移：\n\n```bash\npnpm db:generate\npnpm db:push\n```\n\n### 6. 启动开发服务器\n\n```bash\npnpm dev\n```\n\n在浏览器中打开 [http:\u002F\u002Flocalhost:3000](http:\u002F\u002Flocalhost:3000)。\n\n## 开发\n\n### 数据库操作\n\n```bash\n# 生成迁移\npnpm db:generate\n\n# 推送模式更改\npnpm db:push\n\n# 打开 Drizzle Studio\npnpm db:studio\n```\n\n### 运行应用\n\n```bash\n# 开发\npnpm dev\n\n# 构建生产环境\npnpm build\n\n# 启动生产服务器\npnpm start\n```\n\n## 贡献\n\n1. 分支仓库\n2. 创建功能分支\n3. 进行修改\n4. 全面测试\n5. 提交拉取请求\n\n## 安全注意事项\n\n- **环境变量**：切勿将 `.env` 文件提交到版本控制中。所有敏感数据应存储在环境变量中。\n- **API 密钥**：定期轮换 API 密钥，并遵循最小权限原则。\n- **数据库访问**：确保 PostgreSQL 数据库使用强凭据进行妥善保护。\n- **Vercel 沙盒**：沙盒是隔离的，但请确保不要在日志或输出中暴露敏感数据。\n- **用户身份验证**：每个用户使用自己的 GitHub 令牌访问仓库——不共享凭据。\n- **加密**：所有敏感数据（令牌、API 密钥）均采用基于用户的加密技术进行静态加密。\n\n## 更改记录\n\n### 版本 2.0.0 - 重大更新：用户身份验证与安全性\n\n此版本引入了 **用户身份验证** 和 **重大安全改进**，但包含需要现有部署迁移的 **破坏性变更**。\n\n#### 新特性\n\n- **用户身份验证系统**\n  - 使用 Vercel 登录\n  - 使用 GitHub 登录\n  - 带有加密令牌的会话管理\n  - 用户个人资料管理\n\n- **多用户支持**\n  - 每个用户拥有自己的任务和连接器\n  - 用户可以管理自己的 API 密钥（Anthropic、OpenAI、Cursor、Gemini、AI Gateway）\n  - 可连接 GitHub 账户以访问仓库\n\n- **安全增强**\n  - 基于用户的 GitHub 身份验证——每位用户使用自己的 GitHub 令牌，而非共享凭据\n  - 所有敏感数据（令牌、API 密钥、环境变量）均采用静态加密\n  - 基于会话的身份验证，使用 JWT 加密\n  - 基于用户的授权——用户只能访问属于自己的资源\n\n- **数据库增强**\n  - 新增 `users` 表，用于存储用户个人资料和 OAuth 账户\n  - 新增 `accounts` 表，用于关联账户（例如，Vercel 用户连接 GitHub）\n  - 新增 `keys` 表，用于存储用户提供的 API 密钥\n  - 外键关系确保数据完整性\n  - 支持软删除任务\n\n#### 破坏性变更\n\n**如果从 v1.x 升级，需采取以下措施：**\n\n1. **数据库模式变更**\n   - `tasks` 表现在需要 `userId`（外键指向 `users.id`）\n   - `connectors` 表现在需要 `userId`（外键指向 `users.id`）\n   - `connectors.env` 由 `jsonb` 改为加密的 `text`\n   - 新增 `tasks.deletedAt` 字段，用于软删除\n\n2. **API 变更**\n   - 所有 API 端点现在都需要身份验证\n   - 创建任务时，请求体中必须包含 `userId`\n   - 任务现在按用户所有权进行筛选\n   - 访问 GitHub API 时，使用用户自己的 GitHub 令牌（不再使用共享令牌作为备用）\n\n3. **环境变量**\n   - **新增必填变量：**\n     - `JWE_SECRET`：Base64 编码的会话加密密钥（生成方法：`openssl rand -base64 32`）\n     - `ENCRYPTION_KEY`：32 字节的十六进制字符串，用于加密敏感数据（生成方法：`openssl rand -hex 32`）\n     - `NEXT_PUBLIC_AUTH_PROVIDERS`：配置启用哪些身份验证提供商（`github`、`vercel`，或两者同时）\n\n   - **新增 OAuth 配置（至少需配置一项）：**\n     - GitHub：`NEXT_PUBLIC_GITHUB_CLIENT_ID`、`GITHUB_CLIENT_SECRET`\n     - Vercel：`NEXT_PUBLIC_VERCEL_CLIENT_ID`、`VERCEL_CLIENT_SECRET`\n\n   - **身份验证变更：**\n     - `GITHUB_TOKEN` 不再作为 API 路由中的备用令牌\n     - 用户必须连接自己的 GitHub 账户才能访问仓库\n     - 每个用户仅使用自己的 GitHub 令牌发起请求\n\n4. **强制身份验证**\n   - 所有路由现在都需要用户身份验证\n   - 不再允许匿名访问任务或 API 端点\n   - 用户必须先使用 GitHub 或 Vercel 登录，才能创建任务\n\n#### 现有部署迁移指南\n\n如果你要从 v1.x 升级到 v2.0.0，请按照以下步骤操作：\n\n##### 步骤 1：备份数据库\n\n```bash\n# 创建现有数据库的备份\npg_dump $POSTGRES_URL > backup-before-v2-migration.sql\n```\n\n##### 步骤 2：添加必要的环境变量\n\n将以下新变量添加到你的 `.env.local` 文件或 Vercel 项目设置中：\n\n```bash\n# 会话加密（必填）\nJWE_SECRET=$(openssl rand -base64 32)\nENCRYPTION_KEY=$(openssl rand -hex 32)\n\n# 配置身份验证提供商（必填——至少选择一个）\nNEXT_PUBLIC_AUTH_PROVIDERS=github  # 或 \"vercel\" 或 \"github,vercel\"\n\n# 如果使用 GitHub 身份验证\nNEXT_PUBLIC_GITHUB_CLIENT_ID=your_github_client_id\nGITHUB_CLIENT_SECRET=your_github_client_secret\n\n# 如果使用 Vercel 身份验证\nNEXT_PUBLIC_VERCEL_CLIENT_ID=your_vercel_client_id\nVERCEL_CLIENT_SECRET=your_vercel_client_secret\n```\n\n##### 步骤 3：设置 OAuth 应用程序\n\n为所选的身份验证提供商创建 OAuth 应用程序。详细说明请参阅“本地开发设置”部分。\n\n##### 步骤 4：准备数据库迁移\n\n在运行迁移之前，你需要处理现有数据：\n\n**选项 A：全新开始（建议用于开发环境）**\n\n如果你不需要保留生产数据：\n\n```bash\n\n# 删除现有表并从头开始\npnpm db:push --force\n\n# 这将创建所有具有正确结构的新表\n```\n\n**选项 B：保留现有数据（生产环境）**\n\n如果您需要保留现有的任务\u002F连接器：\n\n1. **先创建一个系统用户：**\n\n```sql\n-- 连接到您的数据库并执行：\nINSERT INTO users (id, provider, external_id, access_token, username, email, created_at, updated_at, last_login_at)\nVALUES (\n  'system-user-migration',\n  'github',\n  'system-migration',\n  'encrypted-placeholder-token',  -- 您需要加密一个占位符令牌\n  '系统迁移用户',\n  NULL,\n  NOW(),\n  NOW(),\n  NOW()\n);\n```\n\n2. **更新现有记录：**\n\n```sql\n-- 为现有任务添加 userId\nALTER TABLE tasks ADD COLUMN user_id TEXT;\nUPDATE tasks SET user_id = 'system-user-migration' WHERE user_id IS NULL;\nALTER TABLE tasks ALTER COLUMN user_id SET NOT NULL;\nALTER TABLE tasks ADD CONSTRAINT tasks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;\n\n-- 为现有连接器添加 userId\nALTER TABLE connectors ADD COLUMN user_id TEXT;\nUPDATE connectors SET user_id = 'system-user-migration' WHERE user_id IS NULL;\nALTER TABLE connectors ALTER COLUMN user_id SET NOT NULL;\nALTER TABLE connectors ADD CONSTRAINT connectors_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;\n\n-- 将连接器的 env 从 jsonb 转换为加密文本（需要在应用层进行加密）\n-- 注意：您需要使用 ENCRYPTION_KEY 手动加密现有的 env 值\n```\n\n3. **运行标准迁移：**\n\n```bash\npnpm db:generate\npnpm db:push\n```\n\n##### 步骤 5：更新代码\n\n拉取最新更改：\n\n```bash\ngit pull origin main\npnpm install\n```\n\n##### 步骤 6：测试认证\n\n1. 启动开发服务器：`pnpm dev`\n2. 访问 `http:\u002F\u002Flocalhost:3000`\n3. 使用您配置的 OAuth 提供商登录\n4. 验证您可以创建和查看任务\n\n##### 步骤 7：验证安全修复\n\n确认以下内容：\n- 用户只能查看自己的任务\n- 文件差异\u002F文件相关端点需要 GitHub 连接\n- 没有 GitHub 连接的用户会看到“需要 GitHub 认证”的错误提示\n- API 路由中未使用 `GITHUB_TOKEN` 备用机制\n\n#### 重要注意事项\n\n- **所有用户在此升级后都需要登录**——不再支持匿名访问。\n- **使用选项 B 迁移时，现有任务将归系统用户所有。**\n- **如果用户之前通过 Vercel 登录，则必须连接 GitHub 才能访问仓库。**\n- **API 密钥现在可以按用户设置**——用户可以在个人资料中覆盖全局 API 密钥。\n- **API 的重大变更**：如果有外部集成调用您的 API，它们需要更新以包含认证信息。","# Coding Agent Template 快速上手指南\n\nCoding Agent Template 是一个用于构建 AI 编程智能体的开源模板。它支持 Claude Code、OpenAI Codex CLI、GitHub Copilot CLI、Cursor CLI、Google Gemini CLI 和 opencode 等多种主流 AI 工具，并利用 [Vercel Sandbox](https:\u002F\u002Fvercel.com\u002Fdocs\u002Fvercel-sandbox) 在隔离的安全环境中自动执行代码任务。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**: macOS, Linux 或 Windows (WSL2 推荐)\n*   **Node.js**: v18.17 或更高版本 (推荐 v20+)\n*   **包管理器**: [pnpm](https:\u002F\u002Fpnpm.io\u002F) (项目首选，也可使用 npm\u002Fyarn 但需自行调整命令)\n*   **数据库**: 本地开发需自备 PostgreSQL 实例，或使用 Vercel 部署时自动配置的 Neon Postgres。\n*   **Vercel 账号**: 用于获取 Sandbox 运行所需的 Team ID、Project ID 和 API Token。\n*   **OAuth 应用**: 需在 GitHub 或 Vercel 平台创建 OAuth App 以支持用户登录。\n\n## 安装步骤\n\n您可以选择一键部署到 Vercel（推荐新手）或在本地进行开发。\n\n### 方式一：一键部署到 Vercel（推荐）\n\n这是最快速的启动方式，会自动配置数据库和环境变量。\n\n1.  点击下方的部署按钮：\n    [![Deploy with Vercel](https:\u002F\u002Fvercel.com\u002Fbutton)](https:\u002F\u002Fvercel.com\u002Fnew\u002Fclone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel-labs%2Fcoding-agent-template&env=SANDBOX_VERCEL_TEAM_ID,SANDBOX_VERCEL_PROJECT_ID,SANDBOX_VERCEL_TOKEN,JWE_SECRET,ENCRYPTION_KEY&envDescription=Required+environment+variables+for+the+coding+agent+template.+You+must+also+configure+at+least+one+OAuth+provider+(GitHub+or+Vercel)+after+deployment.+Optional+API+keys+can+be+added+later.&stores=%5B%7B%22type%22%3A%22postgres%22%7D%5D&project-name=coding-agent-template&repository-name=coding-agent-template)\n2.  按照向导完成部署，系统会自动创建 Neon Postgres 数据库。\n3.  **重要**：部署完成后，进入 Vercel 项目设置，配置至少一个 OAuth 提供商（GitHub 或 Vercel）以启用用户登录功能。\n\n### 方式二：本地开发安装\n\n如果您希望在本地运行和调试，请按以下步骤操作：\n\n1.  **克隆仓库**\n    ```bash\n    git clone https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fcoding-agent-template.git\n    cd coding-agent-template\n    ```\n\n2.  **安装依赖**\n    ```bash\n    pnpm install\n    ```\n    > *提示：国内开发者若下载缓慢，可配置 `.npmrc` 使用淘宝镜像源：`registry=https:\u002F\u002Fregistry.npmmirror.com`*\n\n3.  **配置环境变量**\n    在项目根目录创建 `.env.local` 文件，并填入以下必要变量：\n\n    ```bash\n    # 数据库连接 (本地开发请填写本地 PG 地址，Vercel 部署会自动生成)\n    POSTGRES_URL=\"postgresql:\u002F\u002Fuser:password@localhost:5432\u002Fdbname\"\n\n    # Vercel Sandbox 配置 (从 Vercel 账户设置中获取)\n    SANDBOX_VERCEL_TOKEN=\"your_vercel_token\"\n    SANDBOX_VERCEL_TEAM_ID=\"your_team_id\"\n    SANDBOX_VERCEL_PROJECT_ID=\"your_project_id\"\n\n    # 加密密钥 (生成方法见下方说明)\n    JWE_SECRET=\"base64_encoded_secret\"\n    ENCRYPTION_KEY=\"32_byte_hex_string\"\n\n    # 认证提供商配置 (至少启用一个)\n    NEXT_PUBLIC_AUTH_PROVIDERS=\"github\" \n    # 若启用 GitHub:\n    NEXT_PUBLIC_GITHUB_CLIENT_ID=\"your_github_client_id\"\n    GITHUB_CLIENT_SECRET=\"your_github_client_secret\"\n    # 若启用 Vercel:\n    # NEXT_PUBLIC_VERCEL_CLIENT_ID=\"...\"\n    # VERCEL_CLIENT_SECRET=\"...\"\n    ```\n\n    **密钥生成命令：**\n    ```bash\n    # 生成 JWE_SECRET\n    openssl rand -base64 32\n    # 生成 ENCRYPTION_KEY\n    openssl rand -hex 32\n    ```\n\n4.  **初始化数据库**\n    ```bash\n    pnpm db:push\n    ```\n\n5.  **启动开发服务器**\n    ```bash\n    pnpm dev\n    ```\n\n## 基本使用\n\n启动成功后，访问 `http:\u002F\u002Flocalhost:3000` (本地) 或您的 Vercel 部署域名。\n\n1.  **登录系统**\n    使用已配置的 GitHub 或 Vercel 账号进行安全登录。\n\n2.  **创建任务**\n    *   在界面中输入目标代码仓库的 URL。\n    *   在描述框中输入您希望 AI 完成的任务（例如：\"Add a user login page with JWT authentication\"）。\n    *   **选择智能体**：从下拉菜单中选择您偏好的 AI 工具（如 Claude Code, Cursor CLI 等）。\n    *   **配置超时与保活**：\n        *   *Maximum Duration*: 设置沙箱最大运行时间（5 分钟至 5 小时）。\n        *   *Keep Alive*: 若需任务完成后继续交互或测试，请开启此选项；若仅需一次性修改，保持关闭以节省资源。\n\n3.  **监控进度**\n    任务开始后，您可以在界面上实时查看 AI 智能体的执行日志、安装的依赖以及生成的代码变更。\n\n4.  **查看结果**\n    *   任务完成后，系统会自动创建一个描述性的 Git 分支（由 AI 自动生成名称，如 `feature\u002Fadd-login-A1b2C3`）。\n    *   您可以直接在界面上审查代码差异，或切换到该分支进行后续开发。\n\n5.  **管理任务**\n    通过侧边栏查看所有历史任务的状态、日志及对应的分支链接。","某电商初创团队的后端工程师需要在周五下班前紧急修复多个微服务中的安全漏洞，并统一更新依赖库。\n\n### 没有 coding-agent-template 时\n- **环境配置繁琐**：工程师需在本地手动安装多种 AI CLI 工具（如 Claude Code、Copilot CLI），并为每个工具单独配置 API Key 和环境变量，耗时且易出错。\n- **安全风险高**：直接在本地机器运行未知来源的 AI 生成代码，若代码包含恶意逻辑或破坏性指令，极易污染本地开发环境甚至泄露敏感数据。\n- **协作与追踪困难**：团队成员各自为战，缺乏统一的任务看板，无法实时查看谁在处理哪个仓库的什么任务，进度全靠口头同步。\n- **分支管理混乱**：AI 生成的代码往往直接提交到主分支或命名随意的临时分支，后续合并代码时需要花费大量时间清理和重构 Git 历史。\n\n### 使用 coding-agent-template 后\n- **一键多模型调度**：团队通过统一的 Web 界面即可按需切换 Claude Code 或 Gemini 等不同代理，无需本地配置，系统自动通过 Vercel AI Gateway 路由请求。\n- **沙箱隔离执行**：所有代码修复任务均在 Vercel Sandbox 提供的隔离环境中自动运行，即使代码有误也仅影响临时沙箱，彻底保障本地主机安全。\n- **全流程可视化**：管理者可在仪表盘实时监控每个任务的日志输出和状态，成员间任务分配清晰，支持多用户独立存储任务历史与凭证。\n- **智能 Git 工作流**：系统自动根据任务内容生成语义清晰的 Git 分支名（如 `fix\u002Fauth-security-vuln`），完成编码后自动提交，极大简化了代码审查与合并流程。\n\ncoding-agent-template 将分散、高风险的本地 AI 编码操作转化为集中、安全且可协作的云端自动化工作流，显著提升了研发团队的交付效率与安全性。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fvercel-labs_coding-agent-template_cc327ebc.png","vercel-labs","Vercel Labs","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fvercel-labs_7a3dc422.png","Develop. Preview. Ship. Creators of Next.js.",null,"support@vercel.com","vercel","https:\u002F\u002Fvercel.com","https:\u002F\u002Fgithub.com\u002Fvercel-labs",[83,87,91],{"name":84,"color":85,"percentage":86},"TypeScript","#3178c6",99.5,{"name":88,"color":89,"percentage":90},"CSS","#663399",0.4,{"name":92,"color":93,"percentage":94},"JavaScript","#f1e05a",0.1,1682,273,"2026-04-17T11:05:58","NOASSERTION",4,"Linux, macOS, Windows","未说明",{"notes":103,"python":101,"dependencies":104},"该工具是一个基于 Next.js 的 Web 应用模板，而非本地运行的 Python AI 模型。主要依赖 Node.js 环境（使用 pnpm 包管理器）和 PostgreSQL 数据库。核心功能依赖 Vercel Sandbox 进行代码隔离执行，需配置 Vercel API Token、Team ID 和 Project ID。支持多种 AI 编程助手（如 Claude Code, Codex CLI 等）作为后端代理，需自行配置对应服务的 API Key。认证方面需配置 GitHub 或 Vercel 的 OAuth 凭证。",[105,106,107,108,109,110,111,112],"Next.js 15","React 19","Tailwind CSS","Drizzle ORM","AI SDK 5","PostgreSQL (Neon)","pnpm","Vercel Sandbox",[35,13],"2026-03-27T02:49:30.150509","2026-04-18T02:20:34.966507",[117,122,127,131,135,139],{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},38540,"为什么通过 GitHub 登录时返回 'github_not_configured' 错误或提示 'relation \"users\" does not exist'？","这通常是因为数据库迁移（migrations）未在部署后自动运行，导致缺少必要的表（如 'users'）。解决方法是更新构建设置，确保在每次构建前自动运行数据库迁移：\n1. 添加一个迁移脚本，使用 POSTGRES_URL 应用所有 Drizzle 迁移。\n2. 修改 npm 构建脚本，使其先运行迁移命令，再执行构建。\n此外，请确保已正确配置 GitHub OAuth 应用，并在环境变量中设置了 NEXT_PUBLIC_GITHUB_CLIENT_ID 和 GITHUB_CLIENT_SECRET。","https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fcoding-agent-template\u002Fissues\u002F39",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},38541,"项目中为什么找不到 .env.example 文件？","该文件已被故意移除，以防止在 Fork 项目中意外提交敏感数据。您可以查阅项目的 README 文档，或在 Vercel 部署模板页面（https:\u002F\u002Fvercel.com\u002Ftemplates\u002Fai\u002Fcoding-agent-platform）查看所需和可选的环境变量列表。","https:\u002F\u002Fgithub.com\u002Fvercel-labs\u002Fcoding-agent-template\u002Fissues\u002F17",{"id":128,"question_zh":129,"answer_zh":130,"source_url":121},38542,"部署模板后，如何正确配置 GitHub OAuth 以实现用户登录？","最新的更新引入了 GitHub OAuth 应用程序以支持多租户平台目标。您需要：\n1. 创建一个新的 GitHub OAuth App。\n2. 获取 Client ID 和 Client Secret。\n3. 在部署平台的环境变量中设置 NEXT_PUBLIC_GITHUB_CLIENT_ID 和 GITHUB_CLIENT_SECRET。\n完成上述配置后，用户即可使用自己的 GitHub 账户进行注册和登录。",{"id":132,"question_zh":133,"answer_zh":134,"source_url":121},38543,"一键部署到 Vercel 后数据库未正确配置怎么办？","如果在部署后发现数据库未正确配置（例如缺少表结构），通常是因为迁移步骤未执行。解决方案是手动触发迁移或修改构建流程：确保构建脚本中包含运行 Drizzle 迁移的命令（例如 `drizzle-kit push` 或自定义迁移脚本），并验证 POSTGRES_URL 环境变量已正确指向您的数据库实例。",{"id":136,"question_zh":137,"answer_zh":138,"source_url":121},38544,"该模板是否稳定？为什么自动部署会遇到这么多问题？","该模板目前仍处于快速演进阶段，因此可能会遇到一些变动或不稳定的情况。开发团队正在努力提高测试覆盖率以增加稳定性。对于自动部署中的问题，通常与缺少必要的环境变量（如 GitHub OAuth 配置）或未自动执行数据库迁移有关，请参考相关 FAQ 进行配置修复。",{"id":140,"question_zh":141,"answer_zh":142,"source_url":126},38545,"在哪里可以找到项目所需的所有环境变量说明？","由于 .env.example 文件已被移除，所有必需和可选的环境变量说明均记录在项目的 README 文件中。此外，当您通过 Vercel 链接部署此模板时，部署界面也会列出需要配置的环境变量。访问地址：https:\u002F\u002Fvercel.com\u002Ftemplates\u002Fai\u002Fcoding-agent-platform",[]]