Week 4 Day 2 实施指南

📋 任务清单

Step 1: 在GitHub创建仓库 ⚠️ (需要手动)

请访问 https://github.com/new 创建以下3个仓库:

1. mbe-sdk-python

Repository name: mbe-sdk-python
Description: Python SDK for Mises Behavior Engine
Public: ✅
License: AGPL-3.0
Initialize: ❌ (不勾选README、.gitignore等)

2. mbe-mcp-server

Repository name: mbe-mcp-server
Description: Model Context Protocol Server for MBE
Public: ✅
License: AGPL-3.0
Initialize: ❌

3. mbe-education

Repository name: mbe-education
Description: Open-source Educational Application powered by MBE
Public: ✅
License: AGPL-3.0
Initialize: ❌

创建后,记录URL:


Step 2: 添加远程仓库

创建仓库后,执行以下命令:

# 进入项目目录
cd d:\Mises\mises-behavior-engine

# 添加远程仓库
git remote add sdk-python https://github.com/YOUR_ORG/mbe-sdk-python.git
git remote add mcp-server https://github.com/YOUR_ORG/mbe-mcp-server.git
git remote add education https://github.com/YOUR_ORG/mbe-education.git

# 验证
git remote -v

Step 3: 准备公开项目迁移

3.1 复制项目到public/

# SDK Python
xcopy /E /I /Y opensource\mbe-sdk-python public\sdk-python

# MCP Server
xcopy /E /I /Y opensource\mbe-mcp-server public\mcp-server

# Education
xcopy /E /I /Y opensource\mbe-education public\education

3.2 验证公开代码安全性

# 验证SDK
python tools\publish\validate_public.py public\sdk-python

# 验证MCP
python tools\publish\validate_public.py public\mcp-server

# 验证Education
python tools\publish\validate_public.py public\education

Step 4: 配置Git Subtree

4.1 初始推送

# 推送SDK
git subtree push --prefix=public/sdk-python sdk-python main

# 推送MCP Server
git subtree push --prefix=public/mcp-server mcp-server main

# 推送Education
git subtree push --prefix=public/education education main

4.2 从GitHub拉取(测试)

# 拉取SDK更新
git subtree pull --prefix=public/sdk-python sdk-python main

# 拉取MCP更新
git subtree pull --prefix=public/mcp-server mcp-server main

# 拉取Education更新
git subtree pull --prefix=public/education education main

Step 5: 使用发布脚本

脚本已准备好,位于 tools/publish/ 目录。

发布SDK

.\tools\publish\publish_sdk.ps1

发布MCP Server

.\tools\publish\publish_mcp.ps1

发布Education

.\tools\publish\publish_education.ps1

⚠️ 注意事项

Git凭证配置

首次推送可能需要配置凭证:

# 配置用户信息
git config user.name "Your Name"
git config user.email "your.email@example.com"

# 配置凭证助手 (Windows)
git config --global credential.helper wincred

# 或使用Personal Access Token
# 在GitHub Settings → Developer settings → Personal access tokens 创建

.gitignore配置

确保根目录的.gitignore不包含public/

# 检查.gitignore
type .gitignore | findstr public

# 如果有,需要移除

分支配置

确保使用正确的分支名(main或master):

# 查看当前分支
git branch

# 如果是master,命令中的main改为master

🔍 验证步骤

1. 验证远程仓库

git remote -v

应该看到:

education       https://github.com/YOUR_ORG/mbe-education.git (fetch)
education       https://github.com/YOUR_ORG/mbe-education.git (push)
mcp-server      https://github.com/YOUR_ORG/mbe-mcp-server.git (fetch)
mcp-server      https://github.com/YOUR_ORG/mbe-mcp-server.git (push)
sdk-python      https://github.com/YOUR_ORG/mbe-sdk-python.git (fetch)
sdk-python      https://github.com/YOUR_ORG/mbe-sdk-python.git (push)

2. 验证public/目录

dir public

应该看到:

sdk-python/
mcp-server/
education/

3. 验证代码安全

所有验证应该通过:

✅ SDK验证通过
✅ MCP验证通过
✅ Education验证通过

4. 验证GitHub仓库

访问GitHub查看代码是否成功推送。


📝 完成标准

  • ✅ 3个GitHub仓库创建
  • ✅ Git远程仓库配置
  • ✅ 公开项目迁移到public/
  • ✅ Git Subtree配置成功
  • ✅ 发布脚本测试通过
  • ✅ 代码安全验证通过

🆘 常见问题

Q: git subtree命令太慢?

A: 这是正常的,因为需要重写历史。首次推送会比较慢。

Q: 推送失败?

A: 检查:

  1. 网络连接
  2. GitHub凭证
  3. 仓库权限
  4. 分支名称(main vs master)

Q: 代码验证失败?

A: 检查是否包含私有依赖,使用validate_public.py定位问题。


准备时间: 2026-02-01 执行时间: 预计3-4小时 前置条件: GitHub账号和权限