raycast
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRaycast Extension Development
Raycast扩展开发
Scope
适用范围
Use when writing or modifying a Raycast extension. To open or prepare a PR to
raycast/extensions, use instead.
pr-raycastOverrides global lint/commit defaults in extension directories.
适用于编写或修改Raycast扩展的场景。若要向raycast/extensions发起或准备PR,请改用****。
pr-raycast会覆盖扩展目录中的全局lint/提交默认设置。
Official resources
官方资源
Linting & Formatting
代码检查与格式化
Order: lintro first → Raycast last. Raycast wins on conflicts.
bash
undefined执行顺序: 先运行lintro → 最后运行Raycast工具链。若规则冲突,以Raycast的规则为准。
bash
undefined1. Repo root (when lintro is configured)
1. 仓库根目录(配置lintro后)
uv run lintro fmt && uv run lintro chk
uv run lintro fmt && uv run lintro chk
2. extensions/<name>/ — required before commit
2. extensions/<name>/ — 提交前必须执行
npm run lint
npm run fix-lint && npm run lint # only if lint failed
npm run build # distribution build; CI uses npm
bun run dev # local dev only
Prettier: `printWidth: 120`, `singleQuote: false`. ESLint: `@raycast/eslint-config`.npm run lint
npm run fix-lint && npm run lint # 仅当lint失败时执行
npm run build # 发布构建;CI使用npm
bun run dev # 仅用于本地开发
Prettier配置:`printWidth: 120`,`singleQuote: false`。ESLint使用`@raycast/eslint-config`。Package Management
包管理
- Local dev: ,
bun installbun run <script> - CI/store validation: ,
npm run lintnpm run build
- 本地开发:,
bun installbun run <script> - CI/商店验证:,
npm run lintnpm run build
Project Structure
项目结构
text
src/
├── <command>.tsx
├── components/
├── hooks/
├── lib/
└── types/One command file per commands entry. Extract testable logic to .
Vitest optional; manual test via .
package.jsonlib/bun run devtext
src/
├── <command>.tsx
├── components/
├── hooks/
├── lib/
└── types/每个中的命令对应一个命令文件。可测试逻辑提取到目录。Vitest为可选工具;可通过进行手动测试。
package.jsonlib/bun run devCode patterns
代码模式
- — never manual
getPreferenceValues<Preferences.<Command>>()interfacesPreferences - for user file deletion;
trash()only (no sync fs, no AppleScript)fs/promises - with arg arrays — no shell string interpolation for paths
execFile
- 使用——切勿手动定义
getPreferenceValues<Preferences.<Command>>()接口Preferences - 用户文件删除使用;仅使用
trash()(禁止同步文件系统操作,禁止AppleScript)fs/promises - 使用带参数数组的——路径禁止使用Shell字符串插值
execFile
Constraints
约束条件
- Max 12 keywords; MIT license; US English UI strings
- Max filename length 255 (macOS)
- 最多12个关键词;采用MIT许可证;UI字符串使用美式英语
- 文件名最大长度为255(macOS限制)
Store readiness checklist
商店上架准备清单
Verify before asking to open a PR (full workflow in ).
pr-raycast发起PR前需完成以下验证(完整工作流见****)。
pr-raycastpackage.json
package.json
- Fields: ,
name,title,description,icon,author,platforms,categorieslicense: MIT - Scripts: ,
build,dev,lint,fix-lint(publish)npx @raycast/api@latest publish - Command titles: Title Case (Apple Style Guide)
- committed; no bun/yarn/pnpm lockfiles
package-lock.json
- 字段:、
name、title、description、icon、author、platforms,categories需设为MITlicense - 脚本:、
build、dev、lint、fix-lint(执行publish)npx @raycast/api@latest publish - 命令标题:采用标题大小写格式(遵循Apple风格指南)
- 需提交;禁止提交bun/yarn/pnpm的锁文件
package-lock.json
Assets
资源文件
Icon
(guide,
Icon Maker)
- 512×512 PNG in ; readable on light and dark UI; not default Raycast icon
assets/
Screenshots (specs)
- , 2000×1250 PNG, max 6 (≥3 recommended)
metadata/{extension-name}-{N}.png - Window Capture + Save to Metadata in dev mode; one theme; no sensitive data
图标
(指南,
Icon Maker)
- 尺寸为512×512的PNG图片,存放于目录;在浅色和深色UI下均清晰可读;禁止使用Raycast默认图标
assets/
截图(规范)
- 命名格式为,尺寸2000×1250,最多6张(建议至少3张)
metadata/{extension-name}-{N}.png - 在开发模式下使用窗口捕获 + 保存到元数据功能;统一使用一种主题;禁止包含敏感数据
Docs
文档
- : top entry uses
CHANGELOG.md; accurate features only{PR_MERGE_DATE} - : required if setup needed; README media in
README.md, notmedia/metadata/
- :最新条目需使用
CHANGELOG.md;仅记录准确的功能变更{PR_MERGE_DATE} - :若需要配置说明则必须提供;README中的媒体文件存放于
README.md目录,而非media/metadata/
Contributing to extensions you don't own
贡献非自己维护的扩展
Add yourself to in ; update .
contributorspackage.jsonCHANGELOG.md将自己添加到的字段中;更新。
package.jsoncontributorsCHANGELOG.md