chengfeng-videocut-skills 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CITATION.cff ADDED
@@ -0,0 +1,8 @@
1
+ cff-version: 1.2.0
2
+ title: videocut-skills
3
+ message: "If you use this project, please cite the original repository."
4
+ authors:
5
+ - name: chengfeng / AI产品自由
6
+ repository-code: "https://github.com/Agentchengfeng/chengfeng-videocut-skills"
7
+ url: "https://x.com/chengfeng240928"
8
+ license: Apache-2.0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE.md ADDED
@@ -0,0 +1,27 @@
1
+ # NOTICE
2
+
3
+ Copyright 2026 chengfeng / AI产品自由.
4
+
5
+ This project is created and maintained by **chengfeng / AI产品自由**.
6
+
7
+ Official accounts:
8
+
9
+ - GitHub: https://github.com/Agentchengfeng
10
+ - X: https://x.com/chengfeng240928
11
+ - 小红书:AI产品自由
12
+ - 公众号:AI产品自由
13
+ - B站:AI产品自由
14
+ - 抖音 / 视频号:AI产品自由
15
+
16
+ Original source:
17
+
18
+ ```text
19
+ https://github.com/Agentchengfeng/chengfeng-videocut-skills
20
+ ```
21
+
22
+ Please keep this attribution when using, copying, translating, redistributing, or adapting this project.
23
+
24
+ This repository is licensed under the Apache License, Version 2.0.
25
+ When redistributing this project or derivative works, keep the LICENSE file
26
+ and a readable copy of this NOTICE attribution, as required by Apache-2.0
27
+ Section 4.
package/README.md ADDED
@@ -0,0 +1,281 @@
1
+ # Videocut Skills
2
+
3
+ > 用 Claude Code Skills 构建的视频剪辑 Agent,专为口播视频设计
4
+
5
+ ## 官方来源
6
+
7
+ 本项目由 **chengfeng / AI产品自由** 原创并维护。
8
+
9
+ - GitHub: https://github.com/Agentchengfeng
10
+ - X: https://x.com/chengfeng240928
11
+ - 小红书:AI产品自由
12
+ - 公众号:AI产品自由
13
+ - B站:AI产品自由
14
+ - 抖音 / 视频号:AI产品自由
15
+
16
+ 原始仓库:
17
+
18
+ ```text
19
+ https://github.com/Agentchengfeng/chengfeng-videocut-skills
20
+ ```
21
+
22
+ 如果你使用、转载、翻译、二次发布或改造成自己的 Skill,请保留原作者和原始仓库链接。
23
+
24
+ 本项目使用 **Apache License 2.0**。你可以学习、复制、修改、分发和商用,但重新分发或发布派生版本时,需要保留本仓库的 `LICENSE` 和 `NOTICE.md` 里的来源归属信息。
25
+
26
+ 如果你发现有人删掉来源、换名二次发布:
27
+
28
+ 1. 先保存证据:对方页面链接、截图、发布时间、下载包或 fork 记录。
29
+ 2. 给对方发一句话要求补回来源:请保留 `chengfeng / AI产品自由`、原始仓库链接和 `NOTICE.md`。
30
+ 3. 对方拒绝或不处理时,向平台提交版权/开源协议违规投诉,并附上本仓库链接、`LICENSE`、`NOTICE.md` 和对方删除来源的证据。
31
+ 4. GitHub 上可以开 Issue / Pull Request 要求补回;明显搬运且删来源的,可以走 GitHub DMCA 或平台侵权投诉流程。
32
+
33
+ ## 为什么做这个?
34
+
35
+ 剪映的"智能剪口播"有两个痛点:
36
+ 1. **无法理解语义**:重复说的句子、说错后纠正的内容,它识别不出来
37
+ 2. **字幕质量差**:专业术语(Claude Code、MCP、API)经常识别错误
38
+
39
+ 这个 Agent 用 Claude 的语义理解能力解决第一个问题,用自定义词典解决第二个问题。
40
+
41
+ ## 效果演示
42
+
43
+ **输入**:19 分钟口播原片(各种口误、卡顿、重复)
44
+
45
+ **输出**:
46
+ - 自动识别 608 处问题(静音 114 + 口误/重复 494)
47
+ - 剪辑后视频 72MB
48
+ - 全程 AI 辅助,人工只需确认
49
+
50
+ ## 核心功能
51
+
52
+ | 功能 | 说明 | 对比剪映 |
53
+ |------|------|----------|
54
+ | **语义理解** | AI 逐句分析,识别重说/纠正/卡顿 | 只能模式匹配 |
55
+ | **静音检测** | >0.3s 自动标记,可调阈值 | 固定阈值 |
56
+ | **重复句检测** | 相邻句开头≥5字相同 → 删前保后 | 无此功能 |
57
+ | **句内重复** | "好我们接下来好我们接下来做" → 删重复部分 | 无此功能 |
58
+ | **词典纠错** | 自定义专业术语词典 | 无此功能 |
59
+ | **自更新** | 记住你的偏好,越用越准 | 无此功能 |
60
+
61
+ ## 快速开始
62
+
63
+ ### 1. 安装 Skills
64
+
65
+ 如果你只想复制命令,直接用 npm 安装:
66
+
67
+ ```bash
68
+ npx chengfeng-videocut-skills install
69
+ ```
70
+
71
+ 这个 npm 包只是一个很小的安装器。执行时会从 GitHub 拉取最新仓库:
72
+
73
+ ```text
74
+ https://github.com/Agentchengfeng/chengfeng-videocut-skills
75
+ ```
76
+
77
+ 所以后续只需要维护 GitHub,用户每次执行命令都会安装仓库里的最新 Skills。
78
+
79
+ 它会把 Skills 安装到:
80
+
81
+ - `~/.claude/skills/chengfeng-videocut-skills`
82
+ - `~/.codex/skills/chengfeng-videocut-skills`
83
+
84
+ 也可以只安装到 Codex:
85
+
86
+ ```bash
87
+ npx chengfeng-videocut-skills install --target codex
88
+ ```
89
+
90
+ 如果你习惯从 GitHub 克隆,也可以用:
91
+
92
+ ```bash
93
+ # 克隆到 Claude Code skills 目录
94
+ git clone https://github.com/Agentchengfeng/chengfeng-videocut-skills.git ~/.claude/skills/chengfeng-videocut-skills
95
+ ```
96
+
97
+ ### 2. 配置 API Key
98
+
99
+ ```bash
100
+ cd ~/.claude/skills/chengfeng-videocut-skills
101
+ cp .env.example .env
102
+ # 编辑 .env,填入火山引擎 API Key
103
+ ```
104
+
105
+ ### 3. 安装环境
106
+
107
+ 打开 Claude Code,输入:
108
+
109
+ ```
110
+ /chengfeng-videocut-skills:安装
111
+ ```
112
+
113
+ AI 会自动:
114
+ - 检查 Python、FFmpeg、Node.js
115
+ - 安装 FunASR(口误识别模型,约 2GB)
116
+ - 安装 Whisper large-v3(字幕模型,约 3GB)
117
+
118
+ ## 使用流程
119
+
120
+ ```
121
+ ┌─────────────────────────────────────────────────────────┐
122
+ │ /chengfeng-videocut-skills:安装 → 首次使用,安装环境和模型 │
123
+ └─────────────────────────────────────────────────────────┘
124
+
125
+ ┌─────────────────────────────────────────────────────────┐
126
+ │ /chengfeng-videocut-skills:剪口播 视频.mp4 │
127
+ │ │
128
+ │ 1. 提取音频 → 上传云端 │
129
+ │ 2. 火山引擎转录 → 字级别时间戳 │
130
+ │ 3. AI 审核:静音/口误/重复/语气词 │
131
+ │ 4. 生成审核网页 → 浏览器打开 │
132
+ └─────────────────────────────────────────────────────────┘
133
+
134
+ ┌─────────────────────────────────────────────────────────┐
135
+ │ 【人工审核 + 执行剪辑】 │
136
+ │ │
137
+ │ - 单击跳转播放 │
138
+ │ - 双击选中/取消 │
139
+ │ - Shift 拖动多选 │
140
+ │ - 确认后点击「执行剪辑」→ 自动 FFmpeg 剪辑 │
141
+ └─────────────────────────────────────────────────────────┘
142
+
143
+ ┌─────────────────────────────────────────────────────────┐
144
+ │ /chengfeng-videocut-skills:字幕 │
145
+ │ │
146
+ │ - Whisper 转录 │
147
+ │ - 词典纠错(Claude Code → claude code) │
148
+ │ - 人工确认 → 烧录字幕 │
149
+ └─────────────────────────────────────────────────────────┘
150
+
151
+ ┌─────────────────────────────────────────────────────────┐
152
+ │ /chengfeng-videocut-skills:高清化 (可选) │
153
+ │ │
154
+ │ - 2-pass 编码 + 锐化 │
155
+ │ - 自动匹配原片参数,码率 1.2x │
156
+ │ - 像剪映一样导出高清 │
157
+ └─────────────────────────────────────────────────────────┘
158
+
159
+ ┌─────────────────────────────────────────────────────────┐
160
+ │ /chengfeng-videocut-skills:自更新 (可选) │
161
+ │ │
162
+ │ 告诉 AI 你的偏好,它会记住: │
163
+ │ - "静音阈值改成 1 秒" │
164
+ │ - "保留适量嗯作为过渡" │
165
+ └─────────────────────────────────────────────────────────┘
166
+ ```
167
+
168
+ ## Skill 清单
169
+
170
+ | Skill | 功能 | 输入 | 输出 |
171
+ |-------|------|------|------|
172
+ | `安装` | 环境准备 | 无 | 安装日志 |
173
+ | `剪口播` | 转录 + AI 审核 + 剪辑 | 视频文件 | 剪辑后视频 |
174
+ | `高清化` | 2-pass + 锐化导出 | 视频文件 | 高清视频 |
175
+ | `导入字幕` | 剪后视频直转字幕 + 推送剪映草稿(默认字号 10 / 行间距 13) | 剪后视频 + 可选原稿 | SRT + 剪映草稿 |
176
+ | `自更新` | 记录偏好 | 用户反馈 | 更新规则文件 |
177
+ | `口播成片` | 分镜核对 + 时间线预览 + 合成导出 | 视频 + 字幕 + 可选素材 | 1080x1440 竖版 MP4 |
178
+
179
+ ## 目录结构
180
+
181
+ ```
182
+ chengfeng-videocut-skills/
183
+ ├── README.md # 本文件
184
+ ├── package.json # npm 安装器配置
185
+ ├── .npmignore # npm 发布排除规则
186
+ ├── LICENSE # Apache-2.0 开源协议
187
+ ├── NOTICE.md # 官方来源与转载归属声明
188
+ ├── CITATION.cff # GitHub 引用信息
189
+ ├── .env.example # API Key 模板
190
+ ├── bin/
191
+ │ └── cli.js # npx 安装入口,从 GitHub 拉取最新 Skills
192
+ ├── 安装/ # 环境安装 skill
193
+ ├── 剪口播/ # 核心:转录 + AI 审核 + 剪辑
194
+ │ ├── SKILL.md # 流程说明
195
+ │ ├── *.js # 脚本(生成字幕、审核页面、服务器)
196
+ │ ├── *.sh # 脚本(转录、剪辑)
197
+ │ └── 用户习惯/ # 审核规则(可自定义)
198
+ │ ├── 1-核心原则.md # 删前保后
199
+ │ ├── 2-语气词检测.md # 嗯啊呃
200
+ │ ├── 3-静音段处理.md # >0.3s 删除
201
+ │ ├── 4-重复句检测.md # 相邻句开头相同
202
+ │ ├── 5-卡顿词.md # 那个那个、就是就是
203
+ │ ├── 6-句内重复检测.md # A+中间+A 模式
204
+ │ ├── 7-连续语气词.md # 嗯啊、啊呃
205
+ │ └── 8-重说纠正.md # 部分重复、否定纠正
206
+ ├── 导入字幕/ # 字幕生成与剪映草稿推送
207
+ │ ├── SKILL.md
208
+ │ └── scripts/
209
+ ├── 高清化/ # 2-pass + 锐化导出
210
+ │ └── scripts/
211
+ │ └── hd_export.sh
212
+ ├── 自更新/ # 自我进化机制
213
+ └── 口播成片/ # 分镜核对 -> 时间线预览 -> 合成
214
+ ├── SKILL.md
215
+ ├── templates/ # storyboard-audit.html + timeline-preview.html
216
+ ├── references/
217
+ └── scripts/
218
+ ```
219
+
220
+ ## 技术架构
221
+
222
+ ```
223
+ ┌──────────────────┐ ┌──────────────────┐
224
+ │ 火山引擎 ASR │────▶│ 字级别时间戳 │
225
+ │ (云端转录) │ │ subtitles.json │
226
+ └──────────────────┘ └────────┬─────────┘
227
+
228
+
229
+ ┌──────────────────┐ ┌──────────────────┐
230
+ │ Claude Code │────▶│ AI 审核结果 │
231
+ │ (语义分析) │ │ auto_selected │
232
+ └──────────────────┘ └────────┬─────────┘
233
+
234
+
235
+ ┌──────────────────┐ ┌──────────────────┐
236
+ │ 审核网页 │────▶│ 最终删除列表 │
237
+ │ (人工确认) │ │ delete_segments │
238
+ └──────────────────┘ └────────┬─────────┘
239
+
240
+
241
+ ┌──────────────────┐ ┌──────────────────┐
242
+ │ FFmpeg │────▶│ 剪辑后视频 │
243
+ │ filter_complex │ │ xxx_cut.mp4 │
244
+ └──────────────────┘ └──────────────────┘
245
+ ```
246
+
247
+ ## 依赖
248
+
249
+ | 依赖 | 用途 | 安装方式 |
250
+ |------|------|----------|
251
+ | Node.js 18+ | 运行脚本 | `brew install node` |
252
+ | FFmpeg | 音视频处理 | `brew install ffmpeg` |
253
+ | Python 3.8+ | 模型运行 | 系统自带 |
254
+ | 火山引擎 API | 语音转录 | [申请 Key](https://console.volcengine.com/) |
255
+
256
+ ## 常见问题
257
+
258
+ ### Q: 火山引擎转录超时?
259
+
260
+ 上传音频到 uguu.se(脚本默认),不要用 catbox.moe(火山引擎访问慢)。
261
+
262
+ ### Q: 审核网页打不开?
263
+
264
+ 检查端口 8899 是否被占用:`lsof -i :8899`
265
+
266
+ ### Q: 剪辑后音画不同步?
267
+
268
+ 使用 `filter_complex + trim` 而非 `concat demuxer`,脚本已处理。
269
+
270
+ ### Q: 如何添加自定义词典?
271
+
272
+ 编辑 `字幕/词典.txt`,每行一个词:
273
+ ```
274
+ Claude Code
275
+ MCP
276
+ API
277
+ ```
278
+
279
+ ## License
280
+
281
+ Apache License 2.0. See [LICENSE](LICENSE) and [NOTICE.md](NOTICE.md).
package/bin/cli.js ADDED
@@ -0,0 +1,198 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const os = require("os");
5
+ const path = require("path");
6
+ const { spawnSync } = require("child_process");
7
+
8
+ const defaultRepo = "https://github.com/Agentchengfeng/chengfeng-videocut-skills.git";
9
+ const skillItems = [
10
+ "README.md",
11
+ "LICENSE",
12
+ "NOTICE.md",
13
+ "CITATION.cff",
14
+ ".env.example",
15
+ "剪口播",
16
+ "口播成片",
17
+ "导入字幕",
18
+ "提交",
19
+ "自进化",
20
+ "高清化"
21
+ ];
22
+
23
+ function printHelp() {
24
+ console.log(`chengfeng-videocut-skills
25
+
26
+ Usage:
27
+ npx chengfeng-videocut-skills install [options]
28
+
29
+ Options:
30
+ --target all|claude|codex Install target. Default: all
31
+ --dir <path> Install to a custom directory
32
+ --repo <git-url> Git repository to install from
33
+ -h, --help Show help
34
+
35
+ Examples:
36
+ npx chengfeng-videocut-skills install
37
+ npx chengfeng-videocut-skills install --target codex
38
+ npx chengfeng-videocut-skills install --dir ~/.claude/skills/chengfeng-videocut-skills
39
+ npx chengfeng-videocut-skills install --repo https://github.com/Agentchengfeng/chengfeng-videocut-skills.git
40
+ `);
41
+ }
42
+
43
+ function parseArgs(argv) {
44
+ const options = { command: argv[0], target: "all", dir: null, repo: defaultRepo };
45
+
46
+ if (argv[0] === "-h" || argv[0] === "--help") {
47
+ options.help = true;
48
+ return options;
49
+ }
50
+
51
+ for (let i = 1; i < argv.length; i += 1) {
52
+ const arg = argv[i];
53
+
54
+ if (arg === "--target") {
55
+ options.target = argv[i + 1];
56
+ i += 1;
57
+ continue;
58
+ }
59
+
60
+ if (arg === "--dir") {
61
+ options.dir = argv[i + 1];
62
+ i += 1;
63
+ continue;
64
+ }
65
+
66
+ if (arg === "--repo") {
67
+ options.repo = argv[i + 1];
68
+ i += 1;
69
+ continue;
70
+ }
71
+
72
+ if (arg === "-h" || arg === "--help") {
73
+ options.help = true;
74
+ continue;
75
+ }
76
+
77
+ throw new Error(`Unknown option: ${arg}`);
78
+ }
79
+
80
+ return options;
81
+ }
82
+
83
+ function expandHome(inputPath) {
84
+ if (!inputPath) return inputPath;
85
+ if (inputPath === "~") return os.homedir();
86
+ if (inputPath.startsWith("~/")) {
87
+ return path.join(os.homedir(), inputPath.slice(2));
88
+ }
89
+ return inputPath;
90
+ }
91
+
92
+ function timestamp() {
93
+ return new Date().toISOString().replace(/[-:]/g, "").replace(/\..+/, "").replace("T", "-");
94
+ }
95
+
96
+ function copyItem(source, destination) {
97
+ const stat = fs.statSync(source);
98
+ if (stat.isDirectory()) {
99
+ fs.cpSync(source, destination, { recursive: true, force: true });
100
+ return;
101
+ }
102
+ fs.copyFileSync(source, destination);
103
+ }
104
+
105
+ function run(command, args, options = {}) {
106
+ const result = spawnSync(command, args, {
107
+ stdio: options.stdio || "inherit",
108
+ encoding: "utf8"
109
+ });
110
+
111
+ if (result.error) {
112
+ throw result.error;
113
+ }
114
+
115
+ if (result.status !== 0) {
116
+ throw new Error(`${command} ${args.join(" ")} failed with exit code ${result.status}`);
117
+ }
118
+
119
+ return result;
120
+ }
121
+
122
+ function downloadRepo(repoUrl) {
123
+ const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "chengfeng-videocut-skills-"));
124
+ const destination = path.join(tempRoot, "repo");
125
+
126
+ console.log(`Downloading latest skills from ${repoUrl}`);
127
+ run("git", ["clone", "--depth", "1", repoUrl, destination]);
128
+
129
+ return { sourceRoot: destination, tempRoot };
130
+ }
131
+
132
+ function installTo(sourceRoot, destination) {
133
+ const resolved = path.resolve(expandHome(destination));
134
+ const parent = path.dirname(resolved);
135
+ fs.mkdirSync(parent, { recursive: true });
136
+
137
+ if (fs.existsSync(resolved)) {
138
+ const backup = `${resolved}.backup-${timestamp()}`;
139
+ fs.renameSync(resolved, backup);
140
+ console.log(`Backed up existing skills: ${backup}`);
141
+ }
142
+
143
+ fs.mkdirSync(resolved, { recursive: true });
144
+
145
+ for (const item of skillItems) {
146
+ const source = path.join(sourceRoot, item);
147
+ if (!fs.existsSync(source)) continue;
148
+ copyItem(source, path.join(resolved, item));
149
+ }
150
+
151
+ return resolved;
152
+ }
153
+
154
+ function targetsFor(options) {
155
+ if (options.dir) return [options.dir];
156
+
157
+ if (options.target === "claude") return ["~/.claude/skills/chengfeng-videocut-skills"];
158
+ if (options.target === "codex") return ["~/.codex/skills/chengfeng-videocut-skills"];
159
+ if (options.target === "all") {
160
+ return [
161
+ "~/.claude/skills/chengfeng-videocut-skills",
162
+ "~/.codex/skills/chengfeng-videocut-skills"
163
+ ];
164
+ }
165
+
166
+ throw new Error(`Invalid target: ${options.target}`);
167
+ }
168
+
169
+ function main() {
170
+ const options = parseArgs(process.argv.slice(2));
171
+
172
+ if (options.help || !options.command) {
173
+ printHelp();
174
+ return;
175
+ }
176
+
177
+ if (options.command !== "install") {
178
+ throw new Error(`Unknown command: ${options.command}`);
179
+ }
180
+
181
+ const { sourceRoot, tempRoot } = downloadRepo(options.repo);
182
+ const installed = targetsFor(options).map((target) => installTo(sourceRoot, target));
183
+ fs.rmSync(tempRoot, { recursive: true, force: true });
184
+
185
+ console.log("\nInstalled chengfeng videocut skills:");
186
+ for (const destination of installed) {
187
+ console.log(`- ${destination}`);
188
+ }
189
+ console.log("\nNext: open Claude Code or Codex and use the videocut skills.");
190
+ }
191
+
192
+ try {
193
+ main();
194
+ } catch (error) {
195
+ console.error(`Error: ${error.message}`);
196
+ console.error("Run `npx chengfeng-videocut-skills --help` for usage.");
197
+ process.exitCode = 1;
198
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "chengfeng-videocut-skills",
3
+ "version": "0.1.0",
4
+ "description": "Small installer for Chengfeng's videocut skills.",
5
+ "license": "Apache-2.0",
6
+ "author": "chengfeng / AI产品自由",
7
+ "homepage": "https://github.com/Agentchengfeng/chengfeng-videocut-skills#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Agentchengfeng/chengfeng-videocut-skills.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/Agentchengfeng/chengfeng-videocut-skills/issues"
14
+ },
15
+ "bin": {
16
+ "chengfeng-videocut-skills": "bin/cli.js"
17
+ },
18
+ "files": [
19
+ "bin/",
20
+ "README.md",
21
+ "LICENSE",
22
+ "NOTICE.md",
23
+ "CITATION.cff"
24
+ ],
25
+ "keywords": [
26
+ "videocut",
27
+ "video-editing",
28
+ "skills",
29
+ "claude-code",
30
+ "codex",
31
+ "ai-agent"
32
+ ],
33
+ "engines": {
34
+ "node": ">=18"
35
+ }
36
+ }