用途:本资料面向 Raycast 扩展开发,使用 React、TypeScript 和 Node.js 构建扩展。
快速开始:在 Raycast 中运行 "Create Extension" 命令创建扩展;执行 npm install && npm run dev 安装并开发;修改 src/index.tsx 后自动热重载;扩展会出现在 Raycast 根搜索顶部。
UI 组件选择:可搜索列表用 List,图片画廊用 Grid,收集用户输入用 Form,展示富内容用 Detail(支持 markdown 与 metadata),常驻状态栏用 MenuBarExtra。
核心模式:List 搭配 ActionPanel 提供操作项,如 Action.CopyToClipboard、Action.OpenInBrowser。数据获取可用 @raycast/utils 的 useFetch,配合 isLoading 状态渲染列表。
AI 集成:通过 AI.ask 提问并可用 Clipboard.copy 复制结果。注意 AI 需要 Raycast Pro,可用 environment.canAccess(AI) 检查权限。
参考文档:references/ui-components.md 涵盖 List、Detail、Form、Grid、ActionPanel、MenuBarExtra;references/hooks-utilities.md 涵盖 useFetch、LocalStorage、Clipboard、OAuth、runAppleScript;references/ai-api.md 涵盖 AI.ask、useAI、模型选择与流式输出;references/package-structure.md 涵盖 manifest、命令与偏好设置。
examples/ 目录提供可运行示例:list-with-actions.tsx、list-with-detail.tsx、form-with-validation.tsx、detail-with-metadata.tsx、grid-with-images.tsx、data-fetching.tsx、ai-integration.tsx、menubar-extra.tsx。
限制:资料未提供具体版本要求、平台兼容性细节或收费价格信息。