Community코딩 & 개발github.com

cloudflare/sandbox-migrate-to-next

Cloudflare Sandbox 앱을 안정적인 @cloudflare/sandbox에서 @cloudflare/sandbox@next(SDK 1.0 프리뷰)로 마이그레이션합니다. 이미 프리뷰를 사용 중인 앱은 sandbox-next를 사용하세요.

sandbox-migrate-to-next란 무엇인가요?

이 스킬은 Cloudflare Sandbox 앱을 안정적인 SDK에서 1.0 프리뷰(@next)로 마이그레이션하기 위한 체계적인 워크플로우를 제공합니다. 감사(audit), 패키지 업그레이드, 코드 교체, 검증 단계를 포함하며, Sandbox Workers와 Docker 이미지를 동시에 @next로 업데이트해야 합니다. 주요 변경 사항으로는 RPC 전용 통신, 암시적 셸 없이 argv 기반 프로세스 실행, 세션 API 제거, 수정된 터미널 및 인터프리터 API가 포함됩니다. 이 스킬은 프로덕션 컷오버가 필요한 경우 사용자 동의를 중시하며, 즉시 컨테이너 롤아웃(immediate rollout)을 권장합니다. 마이그레이션 후에는 일상 작업을 위해 sandbox-next 스킬로 전환해야 합니다.

지원 대상~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/cloudflare/skills/tree/main/skills/sandbox-migrate-to-next

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

안정적 → Sandbox SDK 1.0 프리뷰(@next)로 마이그레이션

포트를 수행합니다. 순서대로 단계를 따르세요. 세부 내용은 문서에 있습니다. 단계에 세부 정보가 필요한 경우 연결된 페이지를 가져오세요.

인간 가이드: 마이그레이션 · 1.0 프리뷰

새 프로젝트는 이 스킬이 아닌 @next(sandbox-next)에서 시작해야 합니다. 일상적인 안정적 작업 → sandbox-stable. @next로 이동 없이 사용 중단된 API 정리 → 먼저 2026 사용 중단 가이드가 필요하면 사용하세요.

기존 앱은 가능할 때 마이그레이션하여 1.0이 안정 릴리즈가 될 때 준비가 되어 있어야 합니다. 사용자 동의 없이 프로덕션을 강제로 전환하지 마십시오.

설치된 @next 타입과 마이그레이션 문서를 메모리보다 선호합니다.

워크플로우

  1. 검토 엄격한 규칙 및 교체 맵
  2. 감사 코드베이스; 일치 항목 및 대상 형태 나열
  3. 명확화 사용자와 함께 (컷오버, 브리지, Python 이미지, 불명확한 사이트)
  4. 업그레이드 패키지, 이미지 및 코드
  5. 검증

사용자 결정이 필요한 단계 이후에는 중지합니다.

엄격한 규칙

  • Worker 패키지와 컨테이너 이미지는 동일한 @next 라인이어야 합니다.
  • 프로덕션 컷오버는 즉시 컨테이너 롤아웃을 사용합니다. 안정적 및 @next 제어 프로토콜은 양방향으로 호환되지 않습니다. 점진적 롤아웃은 깨진 혼합 윈도우를 남깁니다. 진행 중인 컨테이너 작업이 중단될 수 있습니다.
  • 컷오버 후 await sandbox.exec(...)는 프로세스 시작을 의미하며 명령 완료를 의미하지 않습니다.
  • Argv는 그대로입니다(암시적 셸 없음). 셸 구문에는 명시적 셸 바이너리가 필요합니다.
  • 프로세스 핸들에는 stdin이 없음 → 대화형 입력을 위한 터미널.
  • 관찰 timeout / AbortSignal은 대기만 취소하며 프로세스는 취소하지 않습니다.
  • 모든 오류에 대한 단일 재시도 루프는 없습니다.
  • API를 발명하지 마십시오(코어의 gitCheckout, 프로세스 stdin, 문자열 실행 완료 헬퍼).
  • 자체 배포 브리지는 안정적으로 유지(아직 프리뷰 라인의 일부가 아님).

교체 맵

안정적@next
SANDBOX_TRANSPORT / transport / setTransport제거 — RPC 전용
await sandbox.exec("cmd") → 버퍼링된 결과await sandbox.exec(argv) → 핸들, 그 다음 output / 대기
execStream / startProcess동일한 핸들: logs, waitFor*, kill
기본 / 명명된 세션사라짐 — cwd/env는 실행마다, 또는 하나의 셸 스크립트
sandbox.terminal(request) / 세션 터미널createTerminal + terminal.connect(request)
xterm sessionIdterminalId
Sandbox의 인터프리터 메서드withInterpreter → sandbox.interpreter.*
gitCheckoutexec를 통한 argv git
문자열 kill 신호숫자만
파일, 마운트, 백업, 포트, 터널, proxyToSandbox대부분 변경되지 않음(안정적 페이지의 세션/전송 비트 무시)

세부 정보: 마이그레이션 · 포트 이후, 일상 작업 → sandbox-next

감사

rg 'SANDBOX_TRANSPORT|transport:|setTransport|enableDefaultSession|createSession|getSession|deleteSession|execStream\(|startProcess\(|killProcess\(|sandbox\.terminal\(|sessionId|gitCheckout\(|SandboxTransport|ExecutionSession'

또한: 문자열 exec(, cd 후 exec, Sandbox의 createCodeContext / runCode.

명확화 (필요할 때 질문)

  • --containers-rollout=immediate로 프로덕션을 전환해도 괜찮습니까? (실행 중인 프로세스/터미널/스트림이 중지될 수 있음)?
  • 자체 배포 브리지? 안정적에 유지.
  • Python 인터프리터 → -python 이미지 변형?
  • 맵으로 다루지 않는 호출 사이트?

업그레이드

패키지 및 이미지

npm install @cloudflare/sandbox@next
FROM cloudflare/sandbox:next
# Python: cloudflare/sandbox:next-python

부동 next가 아닌 경우 Worker와 이미지에서 동일한 프리릴리즈 태그입니다.

영역별 코드

맵에서 교체를 적용합니다. 각 영역에 대해 안정적 습관이 아닌 문서에서 구현합니다.

영역문서
명령 / 핸들 / 대기프로세스 · 프로세스 API
cwd / env / 비밀환경 · 아웃바운드 트래픽
세션 제거마이그레이션 · 수명 주기
터미널터미널
인터프리터인터프리터
오류오류
요청 간 지속 작업프로세스 실행 — 수명/내구성

명령 (형태):

// 이전 (안정적)
const result = await sandbox.exec("npm test");

// 이후 (@next)
const process = await sandbox.exec(["/bin/bash", "-lc", "npm test"]);
const result = await process.output({ encoding: "utf8" });
const server = await sandbox.exec(["/bin/bash", "-lc", "npm run dev"], {
  cwd: "/workspace/app",
});
await server.waitForPort(3000, { timeout: 60_000 });
await server.kill(); // 숫자; 기본 15

터미널 (형태):

const terminal = await sandbox.createTerminal({ command: ["bash"], cwd: "/workspace" });
const t = await sandbox.getTerminal(terminal.id);
if (!t) return new Response("terminal gone", { status: 410 });
return t.connect(request, { cursor, cols, rows });

인터프리터 (형태):

import { Sandbox as BaseSandbox } from "@cloudflare/sandbox";
import { withInterpreter } from "@cloudflare/sandbox/interpreter";

export class Sandbox extends BaseSandbox<Env> {
  interpreter = withInterpreter(this);
}

Git (형태):

const clone = await sandbox.exec(
  ["git", "clone", "--depth", "1", "--", repoUrl, "/workspace/repo"],
  { cwd: "/workspace" },
);
const result = await clone.output({ encoding: "utf8" });

전송 설정을 완전히 삭제합니다. 세션 API를 제거합니다. 별도의 샌드박스 ID로 사용자를 격리합니다.

배포 컷오버

먼저 스테이징/브랜치. 프로덕션은 일치하는 Worker + 이미지의 하나의 배포입니다.

npx wrangler deploy --containers-rollout=immediate

rollout_active_grace_period를 기본 0으로 유지(또는 올린 경우 0으로 설정). 컷오버 후, 배포 전 프로세스/터미널 ID는 유효하지 않습니다. 세부 정보: 마이그레이션 · 컨테이너 롤아웃

검증

  1. Lockfile + Dockerfile이 동일한 @next 라인에 있는지
  2. @next에 대한 타입 체크
  3. argv exec + output({ encoding: "utf8" }) 스모크 테스트
  4. 장기 프로세스 / 터미널 / 인터프리터가 사용된 경우 스모크 테스트
  5. 오류 구분: 사용 불가 / 중단된 RPC / 오래됨 / 로컬 대기
  6. sandbox 환경에 라이브 비밀 없음
  7. 제거된 API 다시 grep
  8. 프로덕션에서 --containers-rollout=immediate 사용

그 후 일상 작업은 **sandbox-next**를 사용합니다.

위험 신호 — 중지하고 수정

  • @next Worker와 안정적 이미지 혼합(또는 그 반대)
  • 이 컷오버를 위한 점진적 컨테이너 롤아웃
  • await exec를 명령 완료로 취급
  • cd / export가 exec 호출 간에 유지된다고 가정
  • 모든 오류에 대한 하나의 재시도 래퍼
  • gitCheckout, 프로세스 stdin 또는 문서화되지 않은 API 발명
  • 배포 후 컷오버 전 프로세스/터미널 ID 유지
  • 사용자 동의 없이 프로덕션 컷오버 강제
  • setEnvVars / 실행 env에 라이브 비밀 저장

Individual skills in this repo

This repo contains 15 individual skills — each has its own dedicated page.

cloudflare/agents-sdk

Build AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, chat applications, voice agents, or browser automation. Covers Agent class, state management, callable RPC, Workflows, durable execution, queues, retries, observability, and React hooks. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

cloudflare/building-ai-agent-on-cloudflare

Builds AI agents on Cloudflare using the Agents SDK with state management, real-time WebSockets, scheduled tasks, tool integration, and chat capabilities. Generates production-ready agent code deployed to Workers. Use when: user wants to "build an agent", "AI agent", "chat agent", "stateful agent", mentions "Agents SDK", needs "real-time AI", "WebSocket AI", or asks about agent "state management", "scheduled tasks", or "tool calling". Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

cloudflare/building-mcp-server-on-cloudflare

Builds remote MCP (Model Context Protocol) servers on Cloudflare Workers with tools, OAuth authentication, and production deployment. Generates server code, configures auth providers, and deploys to Workers. Use when: user wants to "build MCP server", "create MCP tools", "remote MCP", "deploy MCP", add "OAuth to MCP", or mentions Model Context Protocol on Cloudflare. Also triggers on "MCP authentication" or "MCP deployment". Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

cloudflare/cloudflare

Comprehensive Cloudflare platform skill covering Workers, Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), feature flags (Flagship), networking (Tunnel, Spectrum), security (WAF, DDoS), and infrastructure-as-code (Terraform, Pulumi). Use for any Cloudflare development task. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

cloudflare/cloudflare-email-service

Send and receive transactional emails with Cloudflare Email Service (Email Sending + Email Routing). Use when building email sending (Workers binding or REST API), email routing, Agents SDK email handling, or integrating email into any app — Workers, Node.js, Python, Go, etc. Also use for email deliverability, SPF/DKIM/DMARC, wrangler email setup, MCP email tools, or when a coding agent needs to send emails. Even for simple requests like "add email to my Worker" — this skill has critical config details.

cloudflare/cloudflare-one

Design, configure, troubleshoot, or review Cloudflare One Zero Trust and SASE deployments. Use cloudflare-one-migrations for migration planning from other vendors.

cloudflare/durable-objects

Create and review Cloudflare Durable Objects. Use when building stateful coordination (chat rooms, multiplayer games, booking systems), implementing RPC methods, SQLite storage, alarms, WebSockets, or reviewing DO code for best practices. Covers Workers integration, wrangler config, and testing with Vitest. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

cloudflare/sandbox-next

Build or maintain Cloudflare Sandbox apps on @cloudflare/sandbox@next (SDK 1.0 preview). Use sandbox-migrate-to-next when porting a stable app.

cloudflare/sandbox-sdk

Build sandboxed applications for secure code execution. Load when building AI code execution, code interpreters, CI/CD systems, interactive dev environments, or executing untrusted code. Covers Sandbox SDK lifecycle, commands, files, code interpreter, and preview URLs. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

cloudflare/sandbox-stable

Build or maintain Cloudflare Sandbox apps on the stable @cloudflare/sandbox package. Use sandbox-next for preview apps and sandbox-migrate-to-next for stable-to-preview migrations.

cloudflare/skills

Build, migrate, and deploy Next.js apps on Cloudflare Workers with vinext. Use when starting a Next.js project on Cloudflare, moving an existing app to Workers, choosing between vinext and OpenNext, or setting up vinext for Workers. For setup, migration, or deployment, install vinext's upstream skills with `npx skills add cloudflare/vinext` if missing, then read and follow the applicable skill and docs.

cloudflare/turnstile-spin

Set up, repair, or migrate to Cloudflare Turnstile bot verification in an existing frontend and backend, including server-side Siteverify.

cloudflare/web-perf

Analyzes web performance using Chrome DevTools MCP. Measures Core Web Vitals (LCP, INP, CLS) and supplementary metrics (FCP, TBT, Speed Index), identifies render-blocking resources, network dependency chains, layout shifts, caching issues, and accessibility gaps. Use when asked to audit, profile, debug, or optimize page load performance, Lighthouse scores, or site speed. Biases towards retrieval from current documentation over pre-trained knowledge.

cloudflare/workers-best-practices

Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

cloudflare/wrangler

Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

관련 스킬