init: video-create project with skills and accounts
This commit is contained in:
98
.claude/skills/setup.js
Normal file
98
.claude/skills/setup.js
Normal file
@@ -0,0 +1,98 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* 素材生产系统 - 环境配置工具
|
||||
*
|
||||
* 自动检测本地路径,生成 config.json。
|
||||
* 新机器首次使用时运行一次即可。
|
||||
*
|
||||
* 用法: node setup.js
|
||||
*/
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const os = require('os')
|
||||
|
||||
const CONFIG_PATH = path.join(__dirname, 'config.json')
|
||||
|
||||
// ============================================================================
|
||||
// 自动检测
|
||||
// ============================================================================
|
||||
|
||||
function detectJianyingDraftPath() {
|
||||
const username = os.userInfo().username
|
||||
const candidates = [
|
||||
`C:/Users/${username}/AppData/Local/JianyingPro/User Data/Projects/com.lveditor.draft`,
|
||||
`C:/Users/${username}/AppData/Local/CapCut/User Data/Projects/com.lveditor.draft`,
|
||||
]
|
||||
for (const p of candidates) {
|
||||
if (fs.existsSync(p)) return p
|
||||
}
|
||||
return candidates[0] // 默认返回剪映路径(即使不存在)
|
||||
}
|
||||
|
||||
function detectCapcutMateDir() {
|
||||
const username = os.userInfo().username
|
||||
const candidates = [
|
||||
`C:/Users/${username}/capcut-mate`,
|
||||
path.join(os.homedir(), 'capcut-mate'),
|
||||
]
|
||||
for (const p of candidates) {
|
||||
if (fs.existsSync(p)) return p
|
||||
}
|
||||
return candidates[0]
|
||||
}
|
||||
|
||||
function detectCapcutMateApiBase() {
|
||||
return 'http://capcut.muyetools.cn/openapi/capcut-mate/v1'
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// 主流程
|
||||
// ============================================================================
|
||||
|
||||
function main() {
|
||||
console.log('素材生产系统 - 环境配置\n')
|
||||
|
||||
if (fs.existsSync(CONFIG_PATH)) {
|
||||
console.log('config.json 已存在,跳过生成')
|
||||
console.log(` 路径: ${CONFIG_PATH}`)
|
||||
console.log(' 如需重新配置,删除 config.json 后重跑\n')
|
||||
return
|
||||
}
|
||||
|
||||
const config = {
|
||||
jianyingDraftPath: detectJianyingDraftPath(),
|
||||
capcutMateDir: detectCapcutMateDir(),
|
||||
capcutMateApiBase: detectCapcutMateApiBase(),
|
||||
imgbbApiKey: 'deprecated',
|
||||
geminiApiBaseUrl: '',
|
||||
geminiModel: 'gemini-3.1-flash-image-preview',
|
||||
geminiApiKey: '',
|
||||
}
|
||||
|
||||
// 检测结果标注
|
||||
const jianyingExists = fs.existsSync(config.jianyingDraftPath)
|
||||
const capcutExists = fs.existsSync(config.capcutMateDir)
|
||||
|
||||
console.log('自动检测结果:')
|
||||
console.log(` 剪映草稿目录: ${config.jianyingDraftPath} ${jianyingExists ? '[存在]' : '[未找到,请确认剪映已安装]'}`)
|
||||
console.log(` CapCut Mate: ${config.capcutMateDir} ${capcutExists ? '[存在]' : '[未找到,需安装]'}`)
|
||||
console.log(` API 地址: ${config.capcutMateApiBase}`)
|
||||
console.log('')
|
||||
|
||||
fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2), 'utf-8')
|
||||
console.log(`已生成: ${CONFIG_PATH}`)
|
||||
console.log('')
|
||||
console.log('请补充以下必填项:')
|
||||
console.log(' ossRegion - 阿里云 OSS Region')
|
||||
console.log(' ossAccessKeyId - 阿里云 OSS AccessKeyId')
|
||||
console.log(' ossAccessKeySecret - 阿里云 OSS AccessKeySecret')
|
||||
console.log(' ossBucket - 阿里云 OSS Bucket')
|
||||
console.log(' geminiApiBaseUrl - Gemini API 地址')
|
||||
console.log(' geminiApiKey - Gemini API Key')
|
||||
console.log('')
|
||||
console.log('编辑 config.json 后即可使用。')
|
||||
}
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user