catalyst-functions

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

How It Works

工作原理

  1. Verify local scaffold — both
    catalyst init
    and
    functions:add
    support non-interactive mode (CLI v1.27.0+).
    Check whether
    .catalystrc
    and
    catalyst.json
    exist. If missing, use MCP tools to get the org ID and project ID, then run:
    bash
    catalyst init --org <orgId> -p <projectId> -ni
    Never ask the user to run
    catalyst init
    interactively. NI mode can only link an existing project — if none exists, tell the user to create one in the console first. Once initialized, add functions non-interactively:
    bash
    catalyst functions:add --name <name> --type <type> --stack <stack> -ni
    # e.g. catalyst functions:add --name api --type aio --stack node20 -ni
  2. Identify the function type — Basic I/O for simple request/response, Advanced I/O for raw HTTP control, Event for trigger-based, Cron/Job for scheduled, Integration for Zoho service events, Browser Logic for Puppeteer.
  3. Load
    references/functions-basics.md
    — for the matching handler signature,
    catalyst-config.json
    keys, SDK init pattern, and CORS setup.
  4. Load
    references/functions-advanced.md
    — for file uploads (busboy), streaming responses, error handling, or chaining functions.
  5. Load
    references/api-gateway.md
    — for routing rules, rate limiting, or gateway-level CORS.
  6. Validate config — Confirm
    catalyst-config.json
    uses
    deployment
    +
    execution
    keys only. Never use
    function
    or
    entry_point
    .
  1. 验证本地脚手架——
    catalyst init
    functions:add
    均支持非交互模式(CLI v1.27.0+)。
    检查
    .catalystrc
    catalyst.json
    是否存在。若缺失,请使用MCP工具获取组织ID和项目ID,然后运行:
    bash
    catalyst init --org <orgId> -p <projectId> -ni
    切勿要求用户以交互模式运行
    catalyst init
    。非交互模式仅能关联现有项目——若没有现有项目,请告知用户先在控制台创建一个。初始化完成后,以非交互模式添加函数:
    bash
    catalyst functions:add --name <name> --type <type> --stack <stack> -ni
    # 示例:catalyst functions:add --name api --type aio --stack node20 -ni
  2. 识别函数类型——Basic I/O用于简单请求/响应,Advanced I/O用于原始HTTP控制,Event用于基于触发器的场景,Cron/Job用于定时任务,Integration用于Zoho服务事件,Browser Logic用于Puppeteer。
  3. 加载
    references/functions-basics.md
    ——获取匹配的处理程序签名、
    catalyst-config.json
    键、SDK初始化模式及CORS设置。
  4. 加载
    references/functions-advanced.md
    ——获取文件上传(busboy)、流式响应、错误处理或函数链式调用相关内容。
  5. 加载
    references/api-gateway.md
    ——获取路由规则、速率限制或网关级CORS相关内容。
  6. 验证配置——确认
    catalyst-config.json
    仅使用
    deployment
    execution
    键。切勿使用
    function
    entry_point

Security Checklist

安全检查清单

  • Functions are publicly accessible by default. Security Rules sets
    authentication
    to
    optional
    when a function is created — its URL is globally accessible to everyone with no restrictions. Set
    "authentication": "required"
    in the Security Rules JSON for any function that reads or writes user data or sensitive resources.
  • API Gateway replaces Security Rules — do not use both. Enabling API Gateway automatically disables Security Rules. Pick one auth/routing layer per function.
  • 函数默认公开可访问。创建函数时,Security Rules会将
    authentication
    设置为
    optional
    ——其URL对所有人全局开放,无任何限制。对于任何读取或写入用户数据或敏感资源的函数,请在Security Rules JSON中设置
    "authentication": "required"
  • API网关会替代Security Rules——请勿同时使用两者。启用API网关会自动禁用Security Rules。每个函数仅选择一个认证/路由层。

Triggers

触发场景

Use this skill for: "write a function", "catalyst function", "Basic I/O", "Advanced I/O", "Event function", "Cron function", "Browser Logic",
catalyst-config.json
, "function handler", "API Gateway", "rate limiting", "busboy", "file upload in function",
catalyst deploy --only functions:<function-name>
,
catalyst functions:add
, "function CORS", or any function type or function configuration question.
Deployment command note:
  • Use
    catalyst deploy --only functions:<function-name>
    to deploy one function (where
    functions:<name>
    targets the function by its folder name).
  • Use
    catalyst deploy --only functions
    to deploy all functions at once.
当查询内容为以下情况时使用本技能:"write a function"、"catalyst function"、"Basic I/O"、"Advanced I/O"、"Event function"、"Cron function"、"Browser Logic"、
catalyst-config.json
、"function handler"、"API Gateway"、"rate limiting"、"busboy"、"file upload in function"、
catalyst deploy --only functions:<function-name>
catalyst functions:add
、"function CORS"或任何函数类型或函数配置相关问题。
部署命令说明:
  • 使用
    catalyst deploy --only functions:<function-name>
    部署单个函数(其中
    functions:<name>
    通过文件夹名称定位目标函数)。
  • 使用
    catalyst deploy --only functions
    一次性部署所有函数。

References

参考文档

ReferenceLoad when the query is about…
references/functions-basics.md
Start here for any function question. Function type selection, Basic I/O and Advanced I/O handler signatures,
catalyst-config.json
, user-scope vs admin-scope, CORS, Security Rules, execution limits
references/functions-advanced.md
Advanced I/O patterns only. Express vs raw-http template differences, file uploads (busboy), streaming files from Stratus, error handling patterns, CORS for local dev, local testing, function chaining, ZCQL result unwrapping, HTTP payload limits
references/functions-templates.md
Event, Cron, Job, or Integration functions. Handler templates for all background/scheduled types, SDK component reference, retry behavior, cold start data, and the full common errors table
references/api-gateway.md
API Gateway config only. Enable/disable gateway, routing rules, rate limiting, CORS via gateway
参考文档适用查询场景…
references/functions-basics.md
任何函数相关问题均从这里开始。函数类型选择、Basic I/O和Advanced I/O处理程序签名、
catalyst-config.json
、用户作用域vs管理员作用域、CORS、Security Rules、执行限制
references/functions-advanced.md
仅适用于Advanced I/O模式。Express与raw-http模板差异、文件上传(busboy)、从Stratus流式传输文件、错误处理模式、本地开发CORS、本地测试、函数链式调用、ZCQL结果解析、HTTP负载限制
references/functions-templates.md
Event、Cron、Job或Integration函数。所有后台/定时类型的处理程序模板、SDK组件参考、重试机制、冷启动数据及完整的常见错误表
references/api-gateway.md
仅适用于API网关配置。启用/禁用网关、路由规则、速率限制、通过网关配置CORS