castari-deploy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Deploy to Castari

部署到Castari

Deploy a Claude AI agent to production on Castari. This skill walks through the full flow: CLI installation, authentication, project scaffolding, and deployment.
将Claude AI agent部署到Castari的生产环境。本skill会引导完成完整流程:CLI安装、认证、项目脚手架搭建和部署。

Workflow

工作流程

Follow these steps in order. Skip any step whose prerequisite is already satisfied.
按顺序遵循以下步骤。如果某一步的前提条件已满足,可跳过该步骤。

Step 1: Check if the Castari CLI is installed

步骤1:检查Castari CLI是否已安装

Run:
bash
cast --version
If the command fails or is not found, install the CLI:
bash
npm install -g @castari/cli
Then verify installation succeeded by running
cast --version
again.
运行:
bash
cast --version
如果命令执行失败或未找到该命令,请安装CLI:
bash
npm install -g @castari/cli
然后再次运行
cast --version
验证安装是否成功。

Step 2: Check authentication

步骤2:检查认证状态

Run:
bash
cast whoami
If the user is not logged in (command fails or shows "not authenticated"), run:
bash
cast login
This opens a browser for Clerk OAuth. Wait for the user to complete login, then verify with
cast whoami
again.
运行:
bash
cast whoami
如果用户未登录(命令执行失败或显示“not authenticated”),请运行:
bash
cast login
这会打开浏览器进行Clerk OAuth认证。等待用户完成登录,然后再次运行
cast whoami
验证。

Step 3: Check for castari.json

步骤3:检查castari.json文件是否存在

Look for
castari.json
in the current working directory:
bash
ls castari.json
If castari.json exists: Read it and confirm the configuration with the user. Proceed to Step 4.
If castari.json does not exist: Help scaffold one:
  1. Detect the likely entrypoint by checking for these files in order:
    • src/index.ts
    • src/main.ts
    • index.ts
    • src/index.js
    • src/main.js
    • index.js
  2. Ask the user for the agent name using AskUserQuestion. Suggest the current directory name as the default.
  3. Generate
    castari.json
    with this structure:
json
{
  "name": "<agent-name>",
  "version": "0.1.0",
  "entrypoint": "<detected-entrypoint>",
  "runtime": "node"
}
Write the file and show the user what was created.
在当前工作目录中查找
castari.json
bash
ls castari.json
如果castari.json已存在: 读取该文件并与用户确认配置信息。继续步骤4。
如果castari.json不存在: 帮助搭建该文件:
  1. 按以下顺序检查文件,检测可能的入口文件:
    • src/index.ts
    • src/main.ts
    • index.ts
    • src/index.js
    • src/main.js
    • index.js
  2. 使用AskUserQuestion询问用户agent名称,建议将当前目录名称作为默认值。
  3. 生成如下结构的
    castari.json
json
{
  "name": "<agent-name>",
  "version": "0.1.0",
  "entrypoint": "<detected-entrypoint>",
  "runtime": "node"
}
写入文件并向用户展示已创建的内容。

Step 4: Deploy

步骤4:部署

Run the deployment:
bash
cast deploy
This packages the project, uploads it, and deploys to an isolated cloud sandbox. The command may take up to a minute. Show the user the output including status and sandbox ID.
运行部署命令:
bash
cast deploy
这会打包项目、上传并部署到隔离的云沙箱中。该命令可能需要长达一分钟的时间。向用户展示输出内容,包括状态和沙箱ID。

Step 5: Verify deployment

步骤5:验证部署

After successful deployment, show the user a summary:
  • Agent name/slug
  • Deployment status
  • Sandbox ID (if returned)
部署成功后,向用户展示摘要信息:
  • Agent名称/别名
  • 部署状态
  • 沙箱ID(如果返回)

Step 6: Offer to test

步骤6:提供测试选项

Ask the user if they want to test the deployed agent. If yes, ask for a test prompt and run:
bash
cast invoke <agent-slug> "<test-prompt>"
询问用户是否要测试已部署的agent。如果是,请求测试提示并运行:
bash
cast invoke <agent-slug> "<test-prompt>"

Error Handling

错误处理

  • npm not found: Ask the user to install Node.js (>= 18) first.
  • Authentication failure: Suggest running
    cast login
    again or checking network connectivity.
  • No entrypoint detected: Ask the user to specify their entrypoint file manually.
  • Deploy failure: Show the full error output and suggest checking
    castari.json
    configuration or running
    cast agents list
    to verify the agent exists.
  • 未找到npm: 请用户先安装Node.js(版本>=18)。
  • 认证失败: 建议重新运行
    cast login
    或检查网络连接。
  • 未检测到入口文件: 请用户手动指定入口文件。
  • 部署失败: 展示完整的错误输出,并建议检查
    castari.json
    配置或运行
    cast agents list
    验证agent是否存在。

Notes

注意事项

  • The CLI requires Node.js >= 18.
  • Authentication uses Clerk OAuth (browser-based).
  • Deployments run in isolated cloud sandboxes.
  • The
    castari.json
    file is the project manifest — it must be in the repo root.
  • Common entrypoints:
    src/index.ts
    for TypeScript projects,
    index.js
    for JavaScript.
  • CLI需要Node.js >=18版本。
  • 认证使用Clerk OAuth(基于浏览器)。
  • 部署在隔离的云沙箱中运行。
  • castari.json
    文件是项目清单文件,必须位于仓库根目录。
  • 常见入口文件:TypeScript项目为
    src/index.ts
    ,JavaScript项目为
    index.js