Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (yuanflow-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
yuanflow-cli
YuanFlow 的 npm 包,包含两个命令入口:
yuanflow-cli:社媒 API 转 CLI,覆盖完整 registry、快捷命令、schema、dry-run 和 agent-json 输出。yuanflow-skill:把YuanFlow-skill注入到本机支持的 AI Agent skills 目录。
安装
需要 Node.js 20 或更高版本。
npm install -g yuanflow-cli安装后可用:
yuanflow-cli --help
yuanflow-skill list-agentsAPI CLI
yuanflow-cli config set-token <你的令牌>
yuanflow-cli config set-base-url https://open.yuanchuangai.com
yuanflow-cli douyin video-detail "https://v.douyin.com/xxx/" --format agent-json
yuanflow-cli shortcuts douyin
yuanflow-cli commands list
yuanflow-cli schema douyin.video-detail
yuanflow-cli schema comments.douyin.comments
yuanflow-cli comments collect --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
yuanflow-cli works detail --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
yuanflow-cli works download --platform douyin --target "https://v.douyin.com/xxx/" --region CN --format agent-json
yuanflow-cli search content --platform xiaohongshu --keyword "美妆" --format agent-json
yuanflow-cli search users --platform instagram --keyword "nasa" --format agent-json
yuanflow-cli knowledge docs --format agent-json
yuanflow-cli knowledge entry --output-format short_video_script --domain 自媒体运营 --content-goal "写一个创业者短视频选题" --target-audience 创业者 --format agent-json
yuanflow-cli oss signed-url --key path/to/file.png --ttl-seconds 1800 --format agent-json
yuanflow-cli list douyin环境变量:
YUANCHUANG_API_TOKEN=<你的令牌>token 优先级:--token > YUANCHUANG_API_TOKEN > 本地 config.token。独立 CLI 用户可以使用环境变量或 config set-token;在 YuanFlow 主程序内使用时,token 由主程序认证系统注入,不需要手动配置。
作品评论采集
评论采集统一走 comments collect,用于把 Agent 的自然语言需求稳定映射到平台评论接口:
yuanflow-cli comments collect --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
yuanflow-cli comments collect --platform xiaohongshu --target note_id --action replies --comment-id root_comment_id --format agent-json
yuanflow-cli comments collect --platform youtube --target video_id --action comments --dry-run --format agent-json常用参数:
--platform:平台标识,如douyin、xiaohongshu、bilibili、wechat_mp、tiktok、instagram、kuaishou、reddit、twitter、weibo、youtube、zhihu。--action:评论类型,默认comments,可选replies、post_comments、post_replies。--target:作品、文章、帖子、视频或回答 ID,也可以传支持的平台链接。--comment-id:采集二级评论或评论回复时使用。--prefer fallback:使用备用接口。--dry-run:只预览请求映射,不发起真实接口请求,也不要求 token。
Agent 可以先用 yuanflow-cli commands list 查看全部命令,再用 yuanflow-cli schema comments.douyin.comments 查看某个评论采集命令的参数、接口路径和返回说明。
综合作品工具
四类综合工具统一走受控命令,适合 Agent 通过自然语言稳定调用:
yuanflow-cli works detail --platform douyin --target "https://v.douyin.com/xxx/" --format agent-json
yuanflow-cli works download --platform youtube --target "dQw4w9WgXcQ" --format agent-json
yuanflow-cli search content --platform xiaohongshu --keyword "美妆" --format agent-json
yuanflow-cli search users --platform instagram --keyword "nasa" --format agent-json命令 key:
works.<platform>.detail:单作品详情。works.<platform>.download:播放/下载地址候选或视频流信息。search.<platform>.content:内容、作品、笔记、文章、帖子搜索。search.<platform>.users:账号、用户、作者、频道搜索。
Agent 不确定参数时先执行 commands list,再用 schema works.douyin.detail 或 schema search.xiaohongshu.content 查看参数。--dry-run 可预览请求映射,不发起真实接口请求,也不要求 token。
自媒体知识库
知识库能力独立于社媒 /social 接口,走 Yuan API 的 /api/knowledge-base/docs 和 /atomic/agent-rules/navigate:
yuanflow-cli knowledge docs --format agent-json
yuanflow-cli knowledge entry --output-format short_video_script --domain 自媒体运营 --content-goal "写一个创业者短视频选题" --target-audience 创业者 --format agent-json
yuanflow-cli knowledge rules --pack-code topic_pain_point_pack --output-format short_video_script --content-goal "写一个创业者短视频选题" --target-audience 创业者 --format agent-json
yuanflow-cli knowledge rule-detail --rule-code some_rule_code --output-format short_video_script --content-goal "写一个创业者短视频选题" --target-audience 创业者 --format agent-jsonAgent 应先查看 knowledge docs,再把用户需求整理成 task_frame,按接口返回的 next_actions 渐进查询。v2 接口不要求 task_intent;旧字段仅保留兼容。packs、rules 的 data 可能直接是数组,Agent 不应假设固定对象结构,应优先读取 next_actions 继续下钻。
OSS 原子能力
OSS 能力独立封装为 oss 命令,用于临时上传、签名链接和对象复制:
yuanflow-cli oss temp-upload --file ./cover.png --content-type image/png --format agent-json
yuanflow-cli oss signed-url --key path/to/file.png --ttl-seconds 1800 --method GET --format agent-json
yuanflow-cli oss copy --source-key temp/cover.png --target-key final/cover.png --format agent-json上传本地文件前必须确认用户授权,不能上传密钥、cookie、账号凭据或隐私文件。
生图技能
生图技能 随 npm 包安装到 Skill bundle。YuanFlow 主程序内优先使用受控工具 yuanflow_image_request,自动注入当前用户 token 并缓存返回图片。
- 生成图片:
/v1/images/generations,主模型gpt-image-2-c,备用模型gpt-image-2,请求体使用prompt。 - 编辑图片:
/v1/images/edits,必须使用 multipart/form-data 上传本地图片文件。 gpt-image-2-c通常返回 URL,gpt-image-2通常返回b64_json;两种返回都应缓存后再展示。
Skill 安装器
yuanflow-skill list-agents
yuanflow-skill list-skills
yuanflow-skill install
yuanflow-skill install --agent codex,cursor
yuanflow-skill install --project
yuanflow-skill install --dry-run
yuanflow-skill uninstall --agent codex安装器会自动发现 YuanFlow-skill 根目录和一级子目录中的 SKILL.md,并以 yuanflow-skill bundle 形式注入到目标 Agent。
开发检查
npm test
npm run pack:check
npm run release:check