feat: 添加先决条件检查,自动清理已存在的 _bmad 目录避免进入交互模式

This commit is contained in:
zyh
2026-03-30 06:05:22 +00:00
parent 3c95d37477
commit bf40a6d738

View File

@@ -14,17 +14,43 @@ description: 在当前目录安装 BMAD 平台。简单直接:在容器工作
- 更新到最新 BMAD 版本
- 修复损坏的 BMAD 安装
## 先决条件检查
在安装前,需要先检查并清理已存在的 BMAD 目录,避免进入交互模式:
```bash
# 检查 _bmad 目录是否存在
if [ -d "_bmad" ]; then
echo "检测到已存在的 _bmad 目录,正在清理..."
rm -rf _bmad/
echo "清理完成"
fi
```
## 安装命令
```bash
npx bmad-method install \
--directory "$(pwd)" \
--modules bmm \
--tools claude-code \
--output-folder "_bmad-output" \
--user-name "Root" \
--communication-language chinese \
--document-output-language chinese \
--yes
```
**参数说明:**
- `--directory "$(pwd)"` - 明确指定安装到当前项目目录
- `--modules bmm` - 安装 BMAD Methodology 模块
- `--tools claude-code` - 集成 Claude Code 工具
- `--output-folder "_bmad-output"` - 输出文件夹路径默认值_bmad-output
- `--user-name "Root"` - 设置用户名BMAD Agents 会使用此名称称呼你,建议使用真实姓名或团队名称)
- `--communication-language chinese` - 中文交互语言
- `--document-output-language chinese` - 中文文档输出
- `--yes` - 自动确认,跳过交互式提示
## 验证安装
安装完成后检查:
@@ -53,18 +79,40 @@ bmad-help
```bash
# 清理后重试
rm -rf _bmad/ .claude/skills/
npx bmad-method install --modules bmm --tools claude-code --communication-language chinese --yes
npx bmad-method install \
--directory "$(pwd)" \
--modules bmm \
--tools claude-code \
--output-folder "_bmad-output" \
--user-name "Root" \
--communication-language chinese \
--yes
```
### 需要其他模块?
```bash
# 安装完整版本(包含业务分析模块)
npx bmad-method install --modules bmm,bmb --tools claude-code --communication-language chinese --yes
npx bmad-method install \
--directory "$(pwd)" \
--modules bmm,bmb \
--tools claude-code \
--output-folder "_bmad-output" \
--user-name "Root" \
--communication-language chinese \
--yes
```
### 英文环境?
```bash
npx bmad-method install --modules bmm --tools claude-code --communication-language english --document-output-language english --yes
npx bmad-method install \
--directory "$(pwd)" \
--modules bmm \
--tools claude-code \
--output-folder "_bmad-output" \
--user-name "Root" \
--communication-language english \
--document-output-language english \
--yes
```