Cursor rule
.cursor/rules/example-spec.mdc案例规范 — 改动 examples/** 时必须遵守的目录结构、字段、章节
Cursor rules
Quality
69/100
Scores the file, not the repository.Length
599 words
31 headings · 10 code blocksRepository
66
— · pushed 70 days agoLast changed
3 days ago
First indexed 3 days ago.12345678910# 案例规范(examples/**)1112> 改动任何 `examples/<id>-<slug>/` 都要遵守。CI 会用 `scripts/validate-example.mjs` 校验。1314## 目录结构1516```text17examples/<id>-<slug>/18├── README.md # 必填:英文版(5 段,英文 H2 标题)19├── README.zh.md # 必填:中文版(5 段,中文 H2 标题)20├── run.sh # 必填:可执行 + set -euo pipefail21├── meta.json # 必填:通过 schema 校验22├── data/ # 复杂 JSON 拆这里23│ ├── captions.json24│ ├── images.json25│ └── ...26└── preview.gif # 推荐:≤ 3 MB,3-8s27```2829## 命名规则3031- `<id>` 范围:32 - `01~09` = P0 入门案例(官方维护)33 - `10~19` = 营销 / 产品类34 - `20~29` = 知识 / 教育类35 - `30~39` = Vlog / 个人类36 - `99-community/<github-handle>/<case>/` = 社区贡献区37- `<slug>` 用 kebab-case,如 `hello-caption`、`product-promo-30s`3839## meta.json schema4041```json42{43 "id": "01-hello-caption",44 "title": "Hello Caption",45 "tags": ["captions", "animation"],46 "author": "your-github-handle",47 "duration": 5,48 "resolution": "1080x1920",49 "gif": "preview.gif",50 "description": "一句话描述",51 "level": 152}53```5455字段约束(详见 `scripts/_lib/example-schema.mjs`):5657| 字段 | 类型 | 约束 |58|---|---|---|59| `id` | string | `^[a-z0-9][a-z0-9-]*$` |60| `tags` | string[] | 至少 1 个 |61| `duration` | number | > 0 |62| `resolution` | string | `^[0-9]+x[0-9]+$` |63| `level` | int | 1-5(推荐难度) |6465## README.md(英文)+ README.zh.md(中文)必有 5 个 H2 章节6667主 `README.md` 必须用英文章节(CI 严格匹配):6869```markdown70## When to use7172## Run it7374## Key parameters7576## Customize7778## cutcli features used79```8081如果存在 `README.zh.md`(强烈推荐 + `lint:i18n` 强制成对),中文章节必须是:8283```markdown84## 适用场景8586## 一行运行8788## 关键参数解释8990## 进阶改造9192## 用到的 cutcli 能力93```9495第一段必须包含 ``(即使 gif 还没录,也要占位)。两个 README 顶部都要有双语切换链接:9697```markdown98[English](README.md) · [简体中文](README.zh.md)99```100101## run.sh 必有要素102103```bash104#!/usr/bin/env bash105# <id>: <一句话描述>106# Usage: bash run.sh107set -euo pipefail108109if ! command -v cutcli >/dev/null 2>&1; then110 echo "cutcli not found. Install: curl -s https://cutcli.com/cli | bash" >&2111 exit 1112fi113if ! command -v jq >/dev/null 2>&1; then114 echo "jq not found." >&2115 exit 1116fi117118HERE="$(cd "$(dirname "$0")" && pwd)"119120DRAFT_ID=$(cutcli draft create --width 1080 --height 1920 --name "<id>" | jq -r '.draftId')121122# ... 加内容123cutcli captions add "$DRAFT_ID" --captions "@$HERE/data/captions.json" ...124125cutcli draft info "$DRAFT_ID" --pretty126```127128要求:129130- 顶部 shebang `#!/usr/bin/env bash`131- `set -euo pipefail`132- 用 `cutcli`(不是 `cut`)133- 用 `chmod +x run.sh`134- 用 `@$HERE/data/file.json` 引用 JSON(不要内联在命令行里转义)135- 输出关键变量给用户参考136137## 素材 URL 白名单138139`run.sh` 和 `data/*.json` 中的 URL 必须匹配以下之一:140141```regex142^https://cutcli\.com/143^https://[a-z0-9-]+\.r2\.dev/144^https://[a-z0-9-]+\.r2\.cloudflarestorage\.com/145^https://cdn\.jsdelivr\.net/146^https://raw\.githubusercontent\.com/147^https://[a-z0-9-]+\.githubusercontent\.com/148```149150不允许:151152- `http://` 明文153- 个人云盘 / OSS 私链154- 带 query token 的临时签名 URL155156## 时间单位157158**所有时间字段都是微秒**:159160| 期望 | 写法 |161|---|---|162| 0.5 秒 | `500000` |163| 3 秒 | `3000000` |164| 30 秒 | `30000000` |165166错写毫秒(如 `3000` = 3ms)字幕只闪一帧。167168## 关键帧的 segmentId 怎么拿169170`segmentId` 在 add 之前不存在。脚手架模式:171172```bash173# 1. 先 add 片段174cutcli images add "$DRAFT_ID" --image-infos @data/images.json175176# 2. 用 list 拿回 segmentId177SEG=$(cutcli images list "$DRAFT_ID" | jq -r '.[0].segmentId')178179# 3. 用 jq 替换模板里的 __SEG_ID__180KFS=$(jq --arg seg "$SEG" '[.[] | .segmentId = $seg]' "$HERE/data/keyframes.template.json")181182# 4. add 关键帧183cutcli keyframes add "$DRAFT_ID" --keyframes "$KFS"184```185186参考 `examples/05-keyframe-zoom-in/run.sh`。187188## 校验189190提交前必跑:191192```bash193node scripts/validate-example.mjs examples/<your-case>194bash examples/<your-case>/run.sh # 实际跑一遍,剪映打开看效果195```196197校验项:198199- [ ] `run.sh` / `README.md` / `meta.json` 存在200- [ ] `README.zh.md` 存在(`npm run lint:i18n` 强制中英成对)201- [ ] `run.sh` chmod +x、有 shebang、有 `set -euo pipefail`202- [ ] `meta.json` 通过 ajv schema(`description` 英文,可选 `description_zh` 中文)203- [ ] `README.md` 5 个英文章节齐全;`README.zh.md` 5 个中文章节齐全204- [ ] `data/*.json` 都是合法 JSON205- [ ] 所有 URL 在白名单内206- [ ] README 不含本地路径 `/Users/...`207208## 脚手架(推荐入口)209210```bash211node scripts/new-example.mjs my-case-slug212# 按提示输入 author / title / tags / duration / resolution / description213# 自动生成 examples/99-community/<author>/my-case-slug/{README.md,README.zh.md,run.sh,meta.json,data/}214```215216脚手架生成的 `README.md` 是英文骨架(5 段英文 H2),`README.zh.md` 是中文骨架(5 段中文 H2)。两者都已经填好双语切换链接。217218## 最后219220- 拿不准的 case 复杂度,先看 `examples/01~05`(最简单的样板)221- 想做长视频,看 `examples/10~30`(30s~60s)222- 装饰元素(贴纸/特效/滤镜)先 `cutcli query` 找 ID,再 add223
Also in xuliang2024/cutcli-cookbook
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| xuliang2024/cutcli-cookbook.cursor/rules/deploy.mdc · 66 | Cursor rules | gitapideploymentdocs | 74/100 | 3 days ago | |
| xuliang2024/cutcli-cookbook.cursor/rules/commands.mdc · 66 | Cursor rules | lint-formatgitsecuritydeployment+1 | 78/100 | 3 days ago | |
| xuliang2024/cutcli-cookbook.cursor/rules/commit-flow.mdc · 66 | Cursor rules | gitdeploymentdocs | 74/100 | 3 days ago | |
| xuliang2024/cutcli-cookbook.cursor/rules/directory-index.mdc · 66 | Cursor rules | do-notagent-behaviourdocs | 69/100 | 3 days ago | |
| xuliang2024/cutcli-cookbook.cursor/rules/docs-style.mdc · 66 | Cursor rules | builddocs | 73/100 | 3 days ago | |
| xuliang2024/cutcli-cookbook.cursor/rules/open-source-boundary.mdc · 66 | Cursor rules | setup | 69/100 | 3 days ago | |
| xuliang2024/cutcli-cookbook.cursor/rules/project-info.mdc · 66 | Cursor rules | no sections | 50/100 | 3 days ago |
Diff against .cursor/rules/deploy.mdc Diff against .cursor/rules/commands.mdc Diff against .cursor/rules/commit-flow.mdc Diff against .cursor/rules/directory-index.mdc Diff against .cursor/rules/docs-style.mdc Diff against .cursor/rules/open-source-boundary.mdc Diff against .cursor/rules/project-info.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
