prisma-compute

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prisma Compute

Prisma Compute

Guide agents through Prisma Compute app creation, deployment, operations, and framework-specific deploy readiness.
为Agent提供Prisma Compute应用创建、部署、运维以及特定框架部署就绪情况的指导。

Critical: Verify the Current Surface

关键步骤:验证当前命令界面

Prisma Compute is actively moving into the Prisma Platform CLI. Before giving commands or editing a project, verify the local/current command surface:
bash
bunx @prisma/cli@latest app deploy --help
bunx @prisma/cli@latest app --help
bunx create-prisma@latest --help
Use
@prisma/cli@latest
for Compute app deployment unless current help output shows the command has moved. Use
create-prisma@latest
for new-project scaffolding after verifying
--deploy
appears in
create-prisma@latest --help
.
For a compact agent-readable summary, run:
bash
node prisma-compute/scripts/verify-compute-surface.mjs
Set
PRISMA_COMPUTE_RUNNER=bunx
to use
bunx
instead of
npx
.
Prisma Compute 正逐步整合到 Prisma Platform CLI 中。在提供命令或修改项目之前,请验证本地/当前的命令界面:
bash
bunx @prisma/cli@latest app deploy --help
bunx @prisma/cli@latest app --help
bunx create-prisma@latest --help
除非当前帮助输出显示命令已迁移,否则请使用
@prisma/cli@latest
进行 Compute 应用部署。在验证
create-prisma@latest --help
中包含
--deploy
参数后,使用
create-prisma@latest
进行新项目脚手架搭建。
如需获取供Agent快速阅读的精简摘要,请运行:
bash
node prisma-compute/scripts/verify-compute-surface.mjs
设置
PRISMA_COMPUTE_RUNNER=bunx
可使用
bunx
替代
npx

Source-of-Truth Order

信息优先级顺序

Prefer evidence that matches the user's project and installed tooling:
  1. The project's generated scripts and config, especially
    compute:deploy
    ,
    prisma.app.json
    , framework config, and
    package.json
    .
  2. Current CLI help output from
    create-prisma
    and
    @prisma/cli
    .
  3. Local installed package code, generated artifacts, and type definitions.
  4. Official docs or launch notes, especially after Compute is public.
If these disagree, trust the more local/current source and explain the mismatch briefly.
优先采用与用户项目及已安装工具匹配的信息:
  1. 项目生成的脚本和配置,尤其是
    compute:deploy
    prisma.app.json
    、框架配置和
    package.json
  2. create-prisma
    @prisma/cli
    的当前 CLI 帮助输出。
  3. 本地已安装的包代码、生成的产物以及类型定义。
  4. 官方文档或发布说明,尤其是在 Compute 公开之后。
如果上述信息存在冲突,请以更本地化/最新的信息为准,并简要说明不一致之处。

When to Apply

适用场景

Use this skill for:
  • Creating a new app that can deploy to Prisma Compute
  • Deploying an existing TypeScript app to Prisma Compute
  • Deciding whether a framework is Compute-ready
  • Debugging
    create-prisma --deploy
    ,
    compute:deploy
    , or
    app deploy
  • Managing Compute app logs, deployments, environment variables, branches, and domains
  • Running non-interactive deploys with browser auth or Prisma service tokens
  • Programmatic deployments with
    @prisma/compute-sdk
    or Management API integrations
本技能适用于以下场景:
  • 创建可部署到 Prisma Compute 的新应用
  • 将现有 TypeScript 应用部署到 Prisma Compute
  • 判断某框架是否支持 Compute 部署
  • 调试
    create-prisma --deploy
    compute:deploy
    app deploy
    命令
  • 管理 Compute 应用的日志、部署、环境变量、分支和域名
  • 使用浏览器认证或 Prisma 服务令牌执行非交互式部署
  • 通过
    @prisma/compute-sdk
    或管理 API 集成实现程序化部署

Decision Tree

决策树

  1. Existing project deployment or redeploy: Read
    references/app-deploy-cli.md
    .
  2. Framework-specific build/runtime work: Read
    references/frameworks.md
    .
  3. New project from a scaffold: Read
    references/create-prisma.md
    .
  4. Programmatic deployment, SDKs, APIs, or low-level service/version concepts: Read
    references/sdk-api.md
    .
  5. Build, auth, env, deploy, or runtime failures: Read
    references/troubleshooting.md
    .
  1. 现有项目部署或重新部署: 阅读
    references/app-deploy-cli.md
  2. 特定框架的构建/运行时相关工作: 阅读
    references/frameworks.md
  3. 从脚手架创建新项目: 阅读
    references/create-prisma.md
  4. 程序化部署、SDK、API 或底层服务/版本概念: 阅读
    references/sdk-api.md
  5. 构建、认证、环境、部署或运行时故障排查: 阅读
    references/troubleshooting.md

Rules by Priority

优先级规则

PriorityCategoryImpactPrefix
1Command verificationCRITICAL
verify-
2Framework readinessCRITICAL
framework-
3Runtime host and port bindingCRITICAL
runtime-
4Branch, environment, and database wiringHIGH
env-
5Deploy operationsHIGH
deploy-
6SDK and API automationMEDIUM
sdk-
优先级分类影响程度前缀
1命令验证关键
verify-
2框架就绪性关键
framework-
3运行时主机与端口绑定关键
runtime-
4分支、环境与数据库配置
env-
5部署操作
deploy-
6SDK 与 API 自动化
sdk-

Quick Rules

快速规则

1. Command Verification

1. 命令验证

  • verify-help-first
    - Run current help output before assuming package names or flags.
  • verify-helper-script
    - Use
    scripts/verify-compute-surface.mjs
    for a compact current CLI summary when available.
  • verify-prisma-vs-platform-cli
    - Do not assume
    prisma app deploy
    exists in the ORM CLI; check whether the task should use
    @prisma/cli
    .
  • verify-generated-scripts
    - Prefer the generated
    compute:deploy
    script when a project already has one.
  • verify-public-url
    - After a real deploy, smoke-test the public deployment URL instead of trusting local or readiness-only checks.
  • verify-help-first
    - 在假设包名或参数之前,先查看当前帮助输出。
  • verify-helper-script
    - 若可用,使用
    scripts/verify-compute-surface.mjs
    获取当前 CLI 的精简摘要。
  • verify-prisma-vs-platform-cli
    - 不要假设 ORM CLI 中存在
    prisma app deploy
    ;需检查任务是否应使用
    @prisma/cli
  • verify-generated-scripts
    - 若项目已生成
    compute:deploy
    脚本,优先使用该脚本。
  • verify-public-url
    - 实际部署完成后,对公开部署 URL 进行冒烟测试,而非仅依赖本地或就绪性检查。

2. Framework Readiness

2. 框架就绪性

  • framework-cli-first
    - Evaluate deploy readiness against current
    @prisma/cli app deploy
    , not against what
    create-prisma
    can scaffold.
  • framework-supported-cli-deploy
    - Current CLI deploy framework keys are
    nextjs
    ,
    hono
    ,
    tanstack-start
    , and
    bun
    ; verify help/source before using any other key.
  • framework-create-prisma-defaults-only
    -
    create-prisma
    can provide generated defaults and
    compute:deploy
    , but it is not the general deploy surface for existing apps.
  • framework-build-output
    - Compute needs a server entrypoint or framework artifact, not only static output.
  • framework-cli-first
    - 根据当前
    @prisma/cli app deploy
    评估部署就绪性,而非依赖
    create-prisma
    可搭建的模板。
  • framework-supported-cli-deploy
    - 当前 CLI 部署支持的框架标识为
    nextjs
    hono
    tanstack-start
    bun
    ;使用其他标识前需验证帮助文档/源码。
  • framework-create-prisma-defaults-only
    -
    create-prisma
    可提供生成的默认配置和
    compute:deploy
    ,但并非现有应用的通用部署界面。
  • framework-build-output
    - Compute 需要服务器入口点或框架产物,而非仅静态输出。

3. Runtime Host and Port Binding

3. 运行时主机与端口绑定

  • runtime-bind-all-interfaces
    - Deployed servers must bind on all interfaces (
    0.0.0.0
    or the framework equivalent), not hard-coded
    localhost
    or
    127.0.0.1
    .
  • runtime-match-http-port
    - The app must listen on the deployed HTTP port: read
    process.env.PORT
    when possible, or pass the matching
    --http-port
    .
  • runtime-readiness-port-only
    - Compute readiness watches listening ports; a loopback-only listener can look ready while public ingress cannot reach it.
  • runtime-bind-all-interfaces
    - 部署的服务器必须绑定到所有接口(
    0.0.0.0
    或框架等效配置),而非硬编码的
    localhost
    127.0.0.1
  • runtime-match-http-port
    - 应用必须监听部署指定的 HTTP 端口:尽可能读取
    process.env.PORT
    ,或传入匹配的
    --http-port
    参数。
  • runtime-readiness-port-only
    - Compute 通过监听端口判断就绪状态;仅绑定回环地址的监听器可能显示就绪,但外部流量无法访问。

4. Branch, Environment, and Database

4. 分支、环境与数据库

  • env-do-not-leak-secrets
    - Never print full
    DATABASE_URL
    , service tokens, or secret values.
  • env-deploy-loads-dotenv
    - The generated deploy script passes
    --env .env
    ; ensure production values are present before deploy.
  • env-migrations-separate
    - Redeploy scripts do not run migrations or seed data. Run the appropriate Prisma database scripts separately.
  • env-cli-token-name
    - Current
    @prisma/cli
    uses
    PRISMA_SERVICE_TOKEN
    for service-token auth; older Compute CLI and SDK examples may use
    PRISMA_API_TOKEN
    .
  • env-branch-scope
    - Branch deploys, branch env vars, and branch databases must use the same branch name; pass
    --branch <git-name>
    explicitly when targeting a preview branch.
  • env-production-vs-preview
    - Use
    --role production
    for production env,
    --role preview
    for preview template env, and
    --branch <git-name>
    for branch-specific overrides.
  • env-do-not-leak-secrets
    - 绝不要打印完整的
    DATABASE_URL
    、服务令牌或机密值。
  • env-deploy-loads-dotenv
    - 生成的部署脚本会传入
    --env .env
    ;部署前确保已配置生产环境的值。
  • env-migrations-separate
    - 重新部署脚本不会执行数据库迁移或数据填充。需单独运行相应的 Prisma 数据库脚本。
  • env-cli-token-name
    - 当前
    @prisma/cli
    使用
    PRISMA_SERVICE_TOKEN
    进行服务令牌认证;旧版 Compute CLI 和 SDK 示例可能使用
    PRISMA_API_TOKEN
  • env-branch-scope
    - 分支部署、分支环境变量和分支数据库必须使用相同的分支名称;针对预览分支部署时,需显式传入
    --branch <git-name>
    参数。
  • env-production-vs-preview
    - 使用
    --role production
    指定生产环境,
    --role preview
    指定预览模板环境,
    --branch <git-name>
    指定分支特定配置。

5. Deploy Operations

5. 部署操作

  • deploy-prod-intent
    - Use
    --prod --yes
    only when the user intends a production deploy.
  • deploy-noninteractive-auth
    - Non-interactive deploys need either stored CLI login or a supported service token env var; never print the token.
  • deploy-json-for-agents
    - Use
    --json --no-interactive
    for scripts and agent-readable output.
  • deploy-prod-intent
    - 仅当用户明确意图部署到生产环境时,才使用
    --prod --yes
    参数。
  • deploy-noninteractive-auth
    - 非交互式部署需要已存储的 CLI 登录信息或受支持的服务令牌环境变量;绝不要打印令牌。
  • deploy-json-for-agents
    - 脚本和Agent可读输出请使用
    --json --no-interactive
    参数。

6. SDK and API

6. SDK 与 API

  • sdk-use-cli-first
    - Prefer
    @prisma/cli app deploy
    for app workflows; use
    create-prisma
    only to scaffold a new app unless the user is building lower-level automation.
  • sdk-result-handling
    -
    @prisma/compute-sdk
    returns
    Result
    values; check
    isOk()
    /
    isErr()
    instead of relying on exceptions.
  • sdk-use-cli-first
    - 应用工作流优先使用
    @prisma/cli app deploy
    ;除非用户正在构建底层自动化工具,否则仅使用
    create-prisma
    搭建新应用。
  • sdk-result-handling
    -
    @prisma/compute-sdk
    返回
    Result
    类型的值;请检查
    isOk()
    /
    isErr()
    方法,而非依赖异常捕获。

Preferred Workflow

推荐工作流

  1. Inspect the project: package manager, template/framework,
    package.json
    scripts, Prisma version, Prisma client location, and existing
    compute:deploy
    .
  2. Verify CLI help output for the package actually being used, or run
    scripts/verify-compute-surface.mjs
    for the standard Compute surface check.
  3. Choose the path:
    • existing app deploy: generated
      compute:deploy
      or
      @prisma/cli app build/run/deploy
    • new app scaffold:
      create-prisma
      , then generated
      compute:deploy
      or
      @prisma/cli app deploy
    • low-level automation:
      @prisma/compute-sdk
      or Management API
  4. Check framework readiness plus host/port/env/runtime requirements, including project and branch scope.
  5. Run a local build or
    app build
    before deploying when feasible.
  6. Deploy with JSON output when automating, then smoke-test the public URL and summarize app URL, app id, deployment id, project id, and follow-up steps.
  1. 检查项目:包管理器、模板/框架、
    package.json
    脚本、Prisma 版本、Prisma Client 位置以及已有的
    compute:deploy
    脚本。
  2. 验证实际使用的包的 CLI 帮助输出,或运行
    scripts/verify-compute-surface.mjs
    进行标准 Compute 界面检查。
  3. 选择路径:
    • 现有应用部署:使用生成的
      compute:deploy
      脚本或
      @prisma/cli app build/run/deploy
      命令
    • 新应用搭建:使用
      create-prisma
      ,然后使用生成的
      compute:deploy
      脚本或
      @prisma/cli app deploy
      命令
    • 底层自动化:使用
      @prisma/compute-sdk
      或管理 API
  4. 检查框架就绪性以及主机/端口/环境/运行时要求,包括项目和分支范围。
  5. 可行的话,在部署前先运行本地构建或
    app build
    命令。
  6. 自动化部署时使用 JSON 输出,然后对公开 URL 进行冒烟测试,并总结应用 URL、应用 ID、部署 ID、项目 ID 以及后续步骤。

Avoid

注意事项

  • Do not bury Compute deployment guidance in the generic
    prisma-cli
    skill.
  • Do not run
    create-prisma
    inside an existing app just to deploy it; use the generated
    compute:deploy
    script or
    @prisma/cli app deploy
    .
  • Do not tell users that every
    create-prisma
    template can auto-deploy.
  • Do not deploy with placeholder
    DATABASE_URL
    values.
  • Do not assume
    next start
    is the Compute runtime path; Next.js deploys need standalone output.
  • Do not expose secret values from
    .env
    , CLI output, Management API responses, or logs.
  • 不要将 Compute 部署指南隐藏在通用的
    prisma-cli
    技能中。
  • 不要在现有应用内运行
    create-prisma
    来部署应用;请使用生成的
    compute:deploy
    脚本或
    @prisma/cli app deploy
    命令。
  • 不要告知用户所有
    create-prisma
    模板都能自动部署。
  • 不要使用占位符
    DATABASE_URL
    值进行部署。
  • 不要假设
    next start
    是 Compute 的运行时路径;Next.js 部署需要独立输出产物。
  • 不要暴露
    .env
    文件、CLI 输出、管理 API 响应或日志中的机密值。