@keyflow2/create-function-kit
v0.1.2
Published
CLI to scaffold a local Keyflow Function Kit workspace from official starter templates.
Maintainers
Readme
Create Function Kit
一个面向开发者的脚手架命令:把官方 Function Kit starter 解到本地目录,并直接改成你自己的 kitId。
用法
npx @keyflow2/create-function-kit my-launchpad --kit-id yourscope.launchpad --name "Launchpad"执行后会:
- 下载 starter 包(默认:
@keyflow2/function-kit-template-petite-vue) - 解到
my-launchpad/ - 运行 starter 自带的
rename-starter,同步修改:manifest.jsonui/app/main.jsui/app/index.htmlicons/*- 根
package.json的keyflow.defaultKitId
然后你可以直接:
cd .\my-launchpad
npm run open:kitstudio生成后的项目还会自带这些命令:
npm run doctor
npm run pack:zip
npm run pack:npm -- --scope yourscope
npm run publish:npm -- --scope yourscope --dry-run
npm run catalog:check -- --scope yourscope
npm run catalog:entry -- --scope yourscope也就是说,开发者不需要先 clone keyflow 仓库,当前工作区自己就带着:
- KitStudio 启动脚本
- 本地自检脚本
- ZIP / npm 打包脚本
- npm 发布脚本
- catalog 提交前检查脚本
- catalog 提交片段生成脚本
- 平台差异说明文档
如果你看到 [starter] Could not locate KitStudio.,说明脚本没找到你的 KitStudio 仓库位置。你可以:
- 把 KitStudio clone 到工作区同级目录:
..\kit-studio - 或设置环境变量(一次性 / 长期都行):
$env:KITSTUDIO_ROOT = "D:\dev\kit-studio"
npm run open:kitstudio如果你已经有可用的 KitStudio,也可以创建完成后直接打开:
npx @keyflow2/create-function-kit my-launchpad --kit-id yourscope.launchpad --name "Launchpad" --open官方 starter
当前这条 CLI 主要面向两类 starter:
starter/petite-vue- 默认模板
- 适合通用面板、动作型、设置型 Function Kit
- 对应 npm 包:
@keyflow2/function-kit-template-petite-vue
preview-rewrite- 适合纠错 / 润色 / 翻译 / 摘要这类“先生成预览,再确认替换”的正文型 AI Function Kit
- 对应 npm 包:
@keyflow2/function-kit-template-preview-rewrite
查看当前内置别名:
npx @keyflow2/create-function-kit --list-templates常用参数
--kit-id <id>:目标 kitId,推荐用全局唯一风格,例如yourscope.launchpad--name <label>:展示名称--description <text>:覆盖 starter 默认描述--template <name|npm-ref>:改用官方模板别名或自定义 npm starter 包--list-templates:列出官方 starter 别名--kit-studio-root <path>:配合--open使用,显式指定 KitStudio 仓库目录--force:覆盖已存在的目标目录--dry-run:只打印计划动作,不落盘
生成后建议顺序
cd .\my-launchpad
npm run open:kitstudio
npm run doctor
npm run pack:zip确认真机闭环后,再继续:
npm run pack:npm -- --scope yourscope
npm run publish:npm -- --scope yourscope --dry-run
npm run catalog:check -- --scope yourscope
npm run catalog:entry -- --scope yourscope如果你要做正文预览型 AI kit,后续发布前还应该再看:
docs/ANDROID_HOST_RUNBOOK.md
维护者本地开发
如果你在 keyflow 仓库里调这个 CLI,不想真的从 npm 拉 starter,可以直接指向本地模板目录:
node .\templates\create-function-kit\bin\create-function-kit.mjs .\artifacts\smoke\launchpad `
--template-dir .\templates\function-kit-template-petite-vue `
--kit-id keyflow2.launchpad `
--name "Launchpad"正文预览 starter 的本地路径用法:
node .\templates\create-function-kit\bin\create-function-kit.mjs .\artifacts\smoke\proofreader `
--template-dir .\templates\function-kit-template-preview-rewrite `
--kit-id keyflow2.proofreader `
--name "Proofreader"