ai-utils-github
v1.0.0
Published
AI-powered GitHub utilities toolkit
Readme
AI Utils GitHub
AI-powered GitHub utilities toolkit - 一个强大的GitHub工具集
安装
全局安装
npm install -g ai-utils-github使用npx
npx ai-utils-github <command> [options]功能
createRepo - 创建GitHub仓库
创建一个新的GitHub仓库并初始化本地git仓库。
# 使用全局安装的命令
util-github createRepo --github-token "your_github_token" --github-user "your_username" --name "repo_name" --description "Repository description" --git-email "[email protected]" --git-user-name "Your Name"
# 使用npx
npx ai-utils-github createRepo --github-token "your_github_token" --github-user "your_username" --name "repo_name"
# 交互式使用(不提供参数时会提示输入)
util-github createRepo
# 非交互模式(使用 -y 选项,只使用提供的参数和环境变量)
util-github createRepo -y --github-token "your_github_token" --github-user "your_username" --name "repo_name"
# 使用环境变量
export GITHUB_TOKEN="your_github_token"
export GITHUB_USERNAME="your_username"
export GIT_USER_EMAIL="[email protected]"
export GIT_USER_NAME="Your Name"
util-github createRepo --name "repo_name"
# 非交互模式 + 环境变量
util-github createRepo -y --name "repo_name"参数说明
--github-token <token>: GitHub个人访问令牌(必需)--github-user <username>: GitHub用户名(必需)--name <name>: 仓库名称(必需)--description <description>: 仓库描述(可选)--git-email <email>: Git用户邮箱(可选)--git-user-name <name>: Git用户名(可选)-y, --yes: 非交互模式,跳过提示并仅使用提供的选项和环境变量
环境变量支持
可以通过设置以下环境变量来避免重复输入:
GITHUB_TOKEN: GitHub个人访问令牌GITHUB_USERNAME: GitHub用户名GIT_USER_EMAIL: Git用户邮箱GIT_USER_NAME: Git用户名
优先级顺序
参数获取的优先级顺序:
- 命令行参数(最高优先级)
- 环境变量
- 交互式输入(最低优先级)
功能特性
- ✅ 在GitHub上创建远程仓库
- ✅ 初始化本地git仓库
- ✅ 创建README.md文件
- ✅ 配置git用户信息
- ✅ 自动推送到远程仓库
- ✅ 支持自定义仓库描述
- ✅ 支持交互式输入
- ✅ 支持环境变量配置
- ✅ 智能参数优先级处理
- ✅ 支持非交互模式(-y 选项)
- ✅ 智能错误提示(缺少参数时明确指出)
开发
本地开发
# 安装依赖
pnpm install
# 开发模式
pnpm run dev
# 构建
pnpm run build
# 测试构建结果
node dist/index.js --help项目结构
ai-utils-github/
├── src/
│ ├── commands/ # 命令实现
│ │ └── createRepo.ts # createRepo命令
│ └── index.ts # 主入口文件
├── bin/
│ └── cli.js # CLI入口
├── dist/ # 构建输出
├── .codebase/
│ └── genius-ai/
│ └── agent-check.sh # 构建检查脚本
└── package.json扩展功能
项目采用模块化设计,可以轻松添加新的命令:
- 在
src/commands/目录下创建新的命令文件 - 在
src/index.ts中注册新命令 - 重新构建项目
许可证
MIT
