SuperAPI AI 工具集

api2cli-publish-to-github

编程与开发

查看项目

更新于 10-16 06:18

技能介绍

用途:将 api2cli 生成在 ~/.cli/<app>-cli/ 下的 CLI 推送到一个新的 GitHub 仓库。

主要能力:

  1. 预检:运行 gh auth status 检查登录状态;未登录时提示用户先运行 gh auth login 并等待。可从输出中获取 GitHub 用户名。若用户未指定 CLI,则查看 ~/.cli/ 并询问,读取 package.json 获取包名。
  2. 准备仓库:在 CLI 目录确保 .gitignore 至少包含 node_modules/ 与 dist/。若无 .git/ 则运行 git init && git add -A && git commit -m "Initial commit: <app>-cli";若已是 git 仓库则暂存并提交未提交的改动。不得提交 node_modules/ 或 dist/;若已被跟踪,用 git rm -r --cached 移除并重写历史。
  3. 创建并推送:执行 gh repo create <app>-cli --public --source=. --push --description "<来自 package.json 的描述>"。若创建成功但推送失败(如推送保护),按准备阶段修复后运行 git push -u origin <branch> --force。若提示 unable to add remote(远程已存在),直接推送 git push -u origin <branch>。若仓库名被占用,询问用户替代名称。
  4. 完成:报告仓库 URL https://github.com/<username>/<app>-cli、推送内容(文件数、分支名)。

限制:不提交 node_modules/、dist/、.env 或 token 文件;未经询问不对有其它贡献者的既有仓库强制推送;不修改 git 用户配置。资料未提供该技能的收费、价格、平台支持范围等其它信息。