Compare commits
2 Commits
7d6b82efd2
...
70c140f5a7
| Author | SHA1 | Date | |
|---|---|---|---|
| 70c140f5a7 | |||
| 02afe37412 |
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"gitea": {
|
||||
"baseUrl": "http://192.168.2.154:3000",
|
||||
"owner": "sanguo",
|
||||
"repo": "sanguo_moziplus_v3",
|
||||
"defaultBranch": "main"
|
||||
},
|
||||
"rules": {
|
||||
"branchNaming": {
|
||||
"feature": "feature/{task-name}",
|
||||
"fix": "fix/{issue-number}-{description}",
|
||||
"hotfix": "hotfix/{description}"
|
||||
},
|
||||
"commitNaming": {
|
||||
"feature": "feat: {description}",
|
||||
"fix": "fix: {description}",
|
||||
"refactor": "refactor: {description}",
|
||||
"docs": "docs: {description}",
|
||||
"test": "test: {description}"
|
||||
},
|
||||
"prTemplate": {
|
||||
"title": "{task-type}: {description}",
|
||||
"description": "## 任务\n\n{task-description}\n\n## 技术方案\n\n{approach}\n\n## 实现内容\n\n{changes}\n\n## 测试\n\n{tests}"
|
||||
}
|
||||
},
|
||||
"review": {
|
||||
"checklist": [
|
||||
"代码质量",
|
||||
"安全性",
|
||||
"性能",
|
||||
"测试覆盖",
|
||||
"文档完整性"
|
||||
],
|
||||
"approval": "至少 2 个 Reviewer 通过"
|
||||
},
|
||||
"agents": {
|
||||
"main": {
|
||||
"role": "编排者",
|
||||
"responsibilities": [
|
||||
"分析任务",
|
||||
"安排 Sub Agents",
|
||||
"验收整合",
|
||||
"合并 PR"
|
||||
]
|
||||
},
|
||||
"execute": {
|
||||
"role": "执行者",
|
||||
"responsibilities": [
|
||||
"实现功能",
|
||||
"编写测试",
|
||||
"创建 PR"
|
||||
],
|
||||
"skills": ["backend-dev", "frontend-dev"]
|
||||
},
|
||||
"review": {
|
||||
"role": "审查者",
|
||||
"responsibilities": [
|
||||
"代码审查",
|
||||
"添加 Review 评论",
|
||||
"提供修改建议"
|
||||
],
|
||||
"skills": ["CODE-REVIEW", "security-reviewer"]
|
||||
},
|
||||
"test": {
|
||||
"role": "测试者",
|
||||
"responsibilities": [
|
||||
"编写测试",
|
||||
"执行测试",
|
||||
"验证修复"
|
||||
],
|
||||
"skills": ["test-engineer", "e2e-tester"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
/**
|
||||
* Gitea 协作工作流
|
||||
*
|
||||
* Main Agent 通过 Gitea 协调 Sub Agents 完成任务
|
||||
*/
|
||||
|
||||
import { generateGiteaRules, getRepoUrl, getBranchName, getCommitTemplate } from '../helpers/gitea-rules-generator.js'
|
||||
|
||||
export const meta = {
|
||||
name: 'gitea-orchestration',
|
||||
description: '通过 Gitea 协调 Sub Agents 完成开发任务',
|
||||
phases: [
|
||||
{ title: '分析', detail: 'Main Agent 分析任务并创建 Issue' },
|
||||
{ title: '执行', detail: 'Execute Sub Agent 实现并创建 PR' },
|
||||
{ title: '审查', detail: 'Review Sub Agent 审查代码' },
|
||||
{ title: '修复', detail: '如需要,Execute Sub Agent 修复问题' },
|
||||
{ title: '验收', detail: 'Main Agent 验收并合并 PR' }
|
||||
]
|
||||
}
|
||||
|
||||
export default async function giteaOrchestration(task, options = {}) {
|
||||
// 生成 Gitea 规则(从配置文件读取)
|
||||
const giteaRules = generateGiteaRules()
|
||||
const repoUrl = getRepoUrl()
|
||||
|
||||
log(`📦 仓库: ${repoUrl}`)
|
||||
|
||||
// ===== Phase 1: 分析 =====
|
||||
phase('分析')
|
||||
|
||||
// 创建 Issue 记录任务
|
||||
const issue = await createIssue(task, giteaRules)
|
||||
log(`✅ Issue 创建: ${issue.url}`)
|
||||
|
||||
// 分析任务
|
||||
const analysis = await analyzeTask(task)
|
||||
log(`📊 任务复杂度: ${analysis.complexity}`)
|
||||
log(`👥 需要的 Sub Agents: ${analysis.requiredAgents.join(', ')}`)
|
||||
|
||||
// ===== Phase 2: 执行 =====
|
||||
phase('执行')
|
||||
|
||||
const executeResults = []
|
||||
|
||||
// 安排 Execute Sub Agents
|
||||
if (analysis.requiredAgents.includes('backend')) {
|
||||
const backend = await agent({
|
||||
subagent_type: 'claude',
|
||||
label: 'Backend Execute',
|
||||
prompt: `
|
||||
作为后端开发专家,实现以下任务:
|
||||
|
||||
**任务描述**: ${analysis.backendTask}
|
||||
|
||||
**Issue**: ${issue.url}
|
||||
|
||||
${giteaRules}
|
||||
|
||||
执行步骤:
|
||||
1. Clone 仓库
|
||||
2. 创建分支: ${getBranchName('feature', 'backend-' + task.slug)}
|
||||
3. 实现代码
|
||||
4. 编写测试
|
||||
5. Commit 并 Push
|
||||
6. 创建 PR
|
||||
|
||||
完成后返回 PR URL。
|
||||
`
|
||||
})
|
||||
executeResults.push({ type: 'backend', ...backend })
|
||||
log(`✅ Backend Execute 完成: ${backend.prUrl}`)
|
||||
}
|
||||
|
||||
if (analysis.requiredAgents.includes('frontend')) {
|
||||
const frontend = await agent({
|
||||
subagent_type: 'claude',
|
||||
label: 'Frontend Execute',
|
||||
prompt: `
|
||||
作为前端开发专家,实现以下任务:
|
||||
|
||||
**任务描述**: ${analysis.frontendTask}
|
||||
|
||||
**Issue**: ${issue.url}
|
||||
|
||||
${giteaRules}
|
||||
|
||||
执行步骤:
|
||||
1. Clone 仓库
|
||||
2. 创建分支: ${getBranchName('feature', 'frontend-' + task.slug)}
|
||||
3. 实现代码
|
||||
4. 编写测试
|
||||
5. Commit 并 Push
|
||||
6. 创建 PR
|
||||
|
||||
完成后返回 PR URL。
|
||||
`
|
||||
})
|
||||
executeResults.push({ type: 'frontend', ...frontend })
|
||||
log(`✅ Frontend Execute 完成: ${frontend.prUrl}`)
|
||||
}
|
||||
|
||||
// ===== Phase 3: 审查 =====
|
||||
phase('审查')
|
||||
|
||||
if (analysis.requiredAgents.includes('review')) {
|
||||
for (const execute of executeResults) {
|
||||
const review = await agent({
|
||||
subagent_type: 'claude',
|
||||
label: `${execute.type} Review`,
|
||||
prompt: `
|
||||
作为代码审查专家,审查以下 PR:
|
||||
|
||||
**PR URL**: ${execute.prUrl}
|
||||
**Issue**: ${issue.url}
|
||||
|
||||
${giteaRules}
|
||||
|
||||
审查检查:
|
||||
- 代码质量
|
||||
- 安全性
|
||||
- 性能
|
||||
- 测试覆盖
|
||||
|
||||
在 PR 中添加 Review 评论,标注问题代码行。
|
||||
|
||||
完成后返回 Review 结果:
|
||||
{
|
||||
"passed": true|false,
|
||||
"findings": ["问题1", "问题2"],
|
||||
"suggestions": ["建议1", "建议2"]
|
||||
}
|
||||
`
|
||||
})
|
||||
|
||||
execute.review = review
|
||||
log(`${review.passed ? '✅' : '❌'} ${execute.type} Review: ${review.passed ? '通过' : '需要修复'}`)
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Phase 4: 修复 (如需要) =====
|
||||
phase('修复')
|
||||
|
||||
for (const execute of executeResults) {
|
||||
let maxRetries = 3
|
||||
let retryCount = 0
|
||||
|
||||
while (!execute.review?.passed && retryCount < maxRetries) {
|
||||
log(`🔄 ${execute.type} 需要修复 (尝试 ${retryCount + 1}/${maxRetries})`)
|
||||
|
||||
const fix = await agent({
|
||||
subagent_type: 'claude',
|
||||
label: `${execute.type} Fix`,
|
||||
prompt: `
|
||||
**你的 PR 有审查意见,请修复**
|
||||
|
||||
**PR URL**: ${execute.prUrl}
|
||||
**Review 问题**: ${execute.review.findings.join('\n')}
|
||||
|
||||
${giteaRules}
|
||||
|
||||
修复步骤:
|
||||
1. 在 PR 分支上修复问题
|
||||
2. Commit: ${getCommitTemplate('fix').replace('{description}', '修复 Review 问题')}
|
||||
3. Push 更新
|
||||
4. 回复 Review 评论说明修复内容
|
||||
|
||||
修复完成后返回更新后的状态。
|
||||
`
|
||||
})
|
||||
|
||||
log(`✅ ${execute.type} 修复完成`)
|
||||
|
||||
// 重新审查
|
||||
const reReview = await agent({
|
||||
subagent_type: 'claude',
|
||||
label: `${execute.type} Re-review`,
|
||||
prompt: `
|
||||
重新审查 PR: ${execute.prUrl}
|
||||
|
||||
${giteaRules}
|
||||
|
||||
检查之前的 Review 问题是否已修复。
|
||||
|
||||
返回 Review 结果:
|
||||
{
|
||||
"passed": true|false,
|
||||
"findings": ["剩余问题"],
|
||||
"suggestions": ["建议"]
|
||||
}
|
||||
`
|
||||
})
|
||||
|
||||
execute.review = reReview
|
||||
retryCount++
|
||||
|
||||
if (reReview.passed) {
|
||||
log(`✅ ${execute.type} 重新审查通过`)
|
||||
}
|
||||
}
|
||||
|
||||
if (!execute.review?.passed && retryCount >= maxRetries) {
|
||||
log(`⚠️ ${execute.type} 达到最大重试次数,需要人工介入`)
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Phase 5: 验收 =====
|
||||
phase('验收')
|
||||
|
||||
// 安排 Test Sub Agent 验证
|
||||
if (analysis.requiredAgents.includes('test')) {
|
||||
for (const execute of executeResults) {
|
||||
const test = await agent({
|
||||
subagent_type: 'claude',
|
||||
label: `${execute.type} Test`,
|
||||
prompt: `
|
||||
作为测试工程师,验证以下 PR 的功能:
|
||||
|
||||
**PR URL**: ${execute.prUrl}
|
||||
**Issue**: ${issue.url}
|
||||
|
||||
${giteaRules}
|
||||
|
||||
测试步骤:
|
||||
1. 拉取 PR 代码
|
||||
2. 安装依赖
|
||||
3. 运行测试
|
||||
4. 检查测试覆盖率
|
||||
|
||||
返回测试结果:
|
||||
{
|
||||
"passed": true|false,
|
||||
"coverage": "85%",
|
||||
"failures": [],
|
||||
"summary": "测试摘要"
|
||||
}
|
||||
`
|
||||
})
|
||||
|
||||
execute.test = test
|
||||
log(`${test.passed ? '✅' : '❌'} ${execute.type} Test: ${test.passed ? '通过' : '失败'}`)
|
||||
}
|
||||
}
|
||||
|
||||
// 最终验收
|
||||
const allPassed = executeResults.every(e =>
|
||||
e.review?.passed && (!e.test || e.test?.passed)
|
||||
)
|
||||
|
||||
if (allPassed) {
|
||||
// 合并所有 PR
|
||||
for (const execute of executeResults) {
|
||||
await mergePR(execute.prUrl)
|
||||
log(`✅ 已合并 PR: ${execute.prUrl}`)
|
||||
}
|
||||
|
||||
// 关闭 Issue
|
||||
await closeIssue(issue.id)
|
||||
log(`✅ 已关闭 Issue: ${issue.url}`)
|
||||
|
||||
return {
|
||||
status: '完成',
|
||||
issue: issue.url,
|
||||
prs: executeResults.map(e => e.prUrl),
|
||||
message: '任务完成并已合并'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
status: '需要人工介入',
|
||||
issue: issue.url,
|
||||
prs: executeResults.map(e => ({
|
||||
url: e.prUrl,
|
||||
review: e.review,
|
||||
test: e.test
|
||||
})),
|
||||
message: '部分 PR 未通过审查或测试,需要人工处理'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 辅助函数
|
||||
*/
|
||||
async function createIssue(task, rules) {
|
||||
// 实际调用 Gitea API 创建 Issue
|
||||
// 这里返回模拟数据
|
||||
return {
|
||||
id: '123',
|
||||
url: 'http://192.168.2.154:3000/sanguo/sanguo_moziplus_v3/issues/123',
|
||||
number: 123
|
||||
}
|
||||
}
|
||||
|
||||
async function analyzeTask(task) {
|
||||
return await agent({
|
||||
subagent_type: 'Plan',
|
||||
prompt: `
|
||||
分析任务: "${task}"
|
||||
|
||||
返回 JSON:
|
||||
{
|
||||
"complexity": "low|medium|high",
|
||||
"requiredAgents": ["backend", "frontend", "review", "test"],
|
||||
"backendTask": "后端任务描述",
|
||||
"frontendTask": "前端任务描述",
|
||||
"slug": "task-slug"
|
||||
}
|
||||
`,
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
complexity: { type: "string", enum: ["low", "medium", "high"] },
|
||||
requiredAgents: { type: "array", items: { type: "string" } },
|
||||
backendTask: { type: "string" },
|
||||
frontendTask: { type: "string" },
|
||||
slug: { type: "string" }
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function mergePR(prUrl) {
|
||||
// 实际调用 Gitea API 合并 PR
|
||||
log(`合并 PR: ${prUrl}`)
|
||||
}
|
||||
|
||||
async function closeIssue(issueId) {
|
||||
// 实际调用 Gitea API 关闭 Issue
|
||||
log(`关闭 Issue: ${issueId}`)
|
||||
}
|
||||
|
||||
function log(message) {
|
||||
console.log(`[${new Date().toISOString()}] ${message}`)
|
||||
}
|
||||
|
||||
function phase(title) {
|
||||
console.log(`\n=== ${title} ===`)
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
/**
|
||||
* Gitea 规则生成器
|
||||
*
|
||||
* 根据配置文件动态生成 Gitea 协作规则
|
||||
*/
|
||||
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
/**
|
||||
* 读取配置文件
|
||||
*/
|
||||
function loadConfig() {
|
||||
const configPath = path.join(process.cwd(), '.claude', 'gitea-config.json')
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'))
|
||||
return config
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 Gitea URL
|
||||
*/
|
||||
function getGiteaUrl(config) {
|
||||
const { baseUrl, owner, repo } = config.gitea
|
||||
return `${baseUrl}/${owner}/${repo}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 Gitea 规则字符串
|
||||
*/
|
||||
export function generateGiteaRules(config = null) {
|
||||
if (!config) {
|
||||
config = loadConfig()
|
||||
}
|
||||
|
||||
const { baseUrl, owner, repo, defaultBranch } = config.gitea
|
||||
const { branchNaming, commitNaming, prTemplate } = config.rules
|
||||
const { checklist, approval } = config.review
|
||||
|
||||
return `
|
||||
# Gitea 协作规则
|
||||
|
||||
## 仓库信息
|
||||
- **Base URL**: ${baseUrl}
|
||||
- **Owner**: ${owner}
|
||||
- **Repository**: ${repo}
|
||||
- **URL**: ${getGiteaUrl(config)}
|
||||
- **主分支**: ${defaultBranch}
|
||||
|
||||
## 分支命名规则
|
||||
|
||||
| 类型 | 格式 | 示例 |
|
||||
|------|------|------|
|
||||
| 功能开发 | ${branchNaming.feature} | feature/login-api |
|
||||
| 问题修复 | ${branchNaming.fix} | fix/123-auth-error |
|
||||
| 紧急修复 | ${branchNaming.hotfix} | hotfix/security-patch |
|
||||
|
||||
## Commit 命名规则
|
||||
|
||||
| 类型 | 格式 | 示例 |
|
||||
|------|------|------|
|
||||
| 功能 | ${commitNaming.feature} | feat: 添加用户登录 |
|
||||
| 修复 | ${commitNaming.fix} | fix: 修复认证 bug |
|
||||
| 重构 | ${commitNaming.refactor} | refactor: 优化 API 结构 |
|
||||
| 文档 | ${commitNaming.docs} | docs: 更新 API 文档 |
|
||||
| 测试 | ${commitNaming.test} | test: 添加认证测试 |
|
||||
|
||||
## Execute Sub Agent 工作流程
|
||||
|
||||
### 1. 准备阶段
|
||||
\`\`\`bash
|
||||
# Clone 仓库
|
||||
git clone ${getGiteaUrl(config)}.git
|
||||
cd ${repo}
|
||||
|
||||
# 创建功能分支
|
||||
git checkout -b ${branchNaming.feature}
|
||||
\`\`\`
|
||||
|
||||
### 2. 实现阶段
|
||||
- 根据任务要求实现代码
|
||||
- 编写单元测试
|
||||
- 本地测试验证
|
||||
|
||||
### 3. 提交阶段
|
||||
\`\`\`bash
|
||||
git add .
|
||||
git commit -m "${commitNaming.feature}"
|
||||
git push -u origin ${branchNaming.feature}
|
||||
\`\`\`
|
||||
|
||||
### 4. PR 阶段
|
||||
- 在 Gitea 上创建 Pull Request
|
||||
- 标题格式: \`${prTemplate.title}\`
|
||||
- 描述模板:
|
||||
\`\`\`
|
||||
${prTemplate.description}
|
||||
\`\`\`
|
||||
|
||||
## Review Sub Agent 工作流程
|
||||
|
||||
### 1. 审查准备
|
||||
- 阅读 PR 代码变更
|
||||
- 检查以下项目:
|
||||
${checklist.map((item, i) => ` ${i + 1}. ${item}`).join('\n')}
|
||||
|
||||
### 2. 添加 Review
|
||||
- 在 Gitea PR 页面添加 Review 评论
|
||||
- 标注有问题的代码行
|
||||
- 提供具体的修改建议
|
||||
- 返回 Review 结果:
|
||||
|
||||
\`\`\`json
|
||||
{
|
||||
"passed": true|false,
|
||||
"findings": ["问题1", "问题2"],
|
||||
"suggestions": ["建议1", "建议2"],
|
||||
"approval": "${approval}"
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
## Test Sub Agent 工作流程
|
||||
|
||||
### 1. 测试准备
|
||||
- 读取 PR 代码
|
||||
- 理解功能需求
|
||||
|
||||
### 2. 编写测试
|
||||
- 单元测试
|
||||
- 集成测试
|
||||
- E2E 测试(如需要)
|
||||
|
||||
### 3. 执行测试
|
||||
\`\`\`bash
|
||||
npm test
|
||||
# 或
|
||||
pytest
|
||||
\`\`\`
|
||||
|
||||
### 4. 报告结果
|
||||
- 返回测试结果:
|
||||
|
||||
\`\`\`json
|
||||
{
|
||||
"passed": true|false,
|
||||
"coverage": "85%",
|
||||
"failures": [],
|
||||
"summary": "测试结果摘要"
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
## 修复工作流程
|
||||
|
||||
### 1. 接收 Review
|
||||
- 阅读 PR 中的 Review 评论
|
||||
- 理解问题所在
|
||||
|
||||
### 2. 修复问题
|
||||
\`\`\`bash
|
||||
# 在 PR 分支上修复
|
||||
git checkout ${branchNaming.feature}
|
||||
# 进行修复
|
||||
\`\`\`
|
||||
|
||||
### 3. 提交修复
|
||||
\`\`\`bash
|
||||
git add .
|
||||
git commit -m "${commitNaming.fix}"
|
||||
git push
|
||||
\`\`\`
|
||||
|
||||
### 4. 回复 Review
|
||||
- 在 PR 中回复 Review 评论
|
||||
- 说明修复内容
|
||||
|
||||
## 所有 Agent 共享规则
|
||||
|
||||
### 通过 Gitea 读取上下文
|
||||
- Commit 历史 = 上下文历史
|
||||
- PR 变更 = 代码变更
|
||||
- Review 评论 = 审查意见
|
||||
- Issues = 任务记录
|
||||
|
||||
### 通过 Gitea 传递结果
|
||||
- Push 代码 = 传递实现结果
|
||||
- 创建 PR = 请求审查
|
||||
- Review 评论 = 传递审查结果
|
||||
- 合并 PR = 验收完成
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **分支隔离**: 每个任务在独立分支上开发
|
||||
2. **提交清晰**: Commit 信息要清晰描述变更
|
||||
3. **PR 完整**: PR 描述要包含任务、方案、测试
|
||||
4. **Review 及时**: 及时响应 Review 评论
|
||||
5. **测试充分**: 确保测试覆盖充分
|
||||
|
||||
## 配置来源
|
||||
|
||||
本规则由以下配置生成:
|
||||
- 配置文件: .claude/gitea-config.json
|
||||
- 生成时间: ${new Date().toISOString()}
|
||||
`
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取仓库 URL
|
||||
*/
|
||||
export function getRepoUrl(config = null) {
|
||||
if (!config) {
|
||||
config = loadConfig()
|
||||
}
|
||||
return getGiteaUrl(config)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分支名称
|
||||
*/
|
||||
export function getBranchName(type, name, config = null) {
|
||||
if (!config) {
|
||||
config = loadConfig()
|
||||
}
|
||||
const template = config.rules.branchNaming[type] || 'feature/{name}'
|
||||
return template.replace('{name}', name).replace('{task-name}', name)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 Commit 模板
|
||||
*/
|
||||
export function getCommitTemplate(type, config = null) {
|
||||
if (!config) {
|
||||
config = loadConfig()
|
||||
}
|
||||
return config.rules.commitNaming[type] || '{description}'
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 PR 模板
|
||||
*/
|
||||
export function getPrTemplate(config = null) {
|
||||
if (!config) {
|
||||
config = loadConfig()
|
||||
}
|
||||
return config.rules.prTemplate
|
||||
}
|
||||
|
||||
// 导出默认函数
|
||||
export default function generateRules(config = null) {
|
||||
return generateGiteaRules(config)
|
||||
}
|
||||
@@ -0,0 +1,441 @@
|
||||
# sanguo_moziplus_v3 v0.5 部署指南
|
||||
|
||||
## 概述
|
||||
|
||||
v0.5 采用 Main + Sub Agent 动态编排架构,通过 Gitea 进行协作管理。
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 前置要求
|
||||
|
||||
- Claude Code v2.1.39+
|
||||
- Node.js v18+ (用于运行工作流脚本)
|
||||
- Git
|
||||
- Gitea 实例 (或 GitHub)
|
||||
|
||||
### 一键部署
|
||||
|
||||
```bash
|
||||
# 1. 克隆仓库
|
||||
git clone http://192.168.2.154:3000/sanguo/sanguo_moziplus_v3.git
|
||||
cd sanguo_moziplus_v3
|
||||
|
||||
# 2. 运行初始化脚本
|
||||
./scripts/init.sh
|
||||
|
||||
# 3. 配置 Gitea 连接
|
||||
# 编辑 .claude/gitea-config.json
|
||||
|
||||
# 4. 启动 Claude Code
|
||||
cd ~/.openclaw/sanguo_projects/sanguo_moziplus_v3
|
||||
claude
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 详细步骤
|
||||
|
||||
### 步骤 1: 环境配置
|
||||
|
||||
#### 1.1 配置 GLM-5.2
|
||||
|
||||
创建 `~/.claude/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
|
||||
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
|
||||
"ANTHROPIC_API_KEY": "你的智谱API_Key",
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.2[1m]",
|
||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.2[1m]"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 1.2 配置 Gitea
|
||||
|
||||
编辑项目中的 `.claude/gitea-config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"gitea": {
|
||||
"baseUrl": "http://192.168.2.154:3000",
|
||||
"owner": "sanguo",
|
||||
"repo": "sanguo_moziplus_v3",
|
||||
"defaultBranch": "main"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 步骤 2: 安装依赖
|
||||
|
||||
```bash
|
||||
# 确保项目目录正确
|
||||
cd ~/.openclaw/sanguo_projects/sanguo_moziplus_v3
|
||||
|
||||
# 工作流脚本需要 Node.js (如需运行 JavaScript 工作流)
|
||||
npm install --save-dev fs path
|
||||
```
|
||||
|
||||
### 步骤 3: 创建 Main Agent 配置
|
||||
|
||||
创建 `.claude/CLAUDE.md`:
|
||||
|
||||
```markdown
|
||||
# sanguo_moziplus_v3 - Main Agent (编排者)
|
||||
|
||||
## 角色
|
||||
|
||||
你是任务编排者,负责通过 Gitea 协调 Sub Agents 完成开发任务。
|
||||
|
||||
## 核心职责
|
||||
|
||||
1. 分析任务需求
|
||||
2. 根据 Gitea 规则安排 Sub Agents
|
||||
3. 通过 Gitea 追踪进度
|
||||
4. 验收并合并 PR
|
||||
|
||||
## Gitea 协作流程
|
||||
|
||||
### 任务开始
|
||||
1. 创建 Issue 记录任务
|
||||
2. 安排 Execute Sub Agent
|
||||
3. 追踪 PR 创建
|
||||
|
||||
### 任务执行
|
||||
- Execute Sub Agent: 实现代码 → Push → 创建 PR
|
||||
- Review Sub Agent: 审查 PR → 添加评论
|
||||
- Test Sub Agent: 测试功能 → 报告结果
|
||||
|
||||
### 任务完成
|
||||
1. 所有 Review 通过
|
||||
2. 所有测试通过
|
||||
3. 合并 PR
|
||||
4. 关闭 Issue
|
||||
|
||||
## Gitea 规则
|
||||
|
||||
所有 Sub Agent 都需要遵循 Gitea 规则,规则从配置文件生成。
|
||||
|
||||
查看当前规则: 读取 .claude/gitea-config.json
|
||||
|
||||
## 严格限制
|
||||
|
||||
- 不亲自编写代码
|
||||
- 所有编码任务通过 Sub Agents 在 Gitea 上完成
|
||||
|
||||
## 可用能力
|
||||
|
||||
- planning: 复杂任务规划
|
||||
- CODE-REVIEW: 代码审查
|
||||
- debugger: 问题调试
|
||||
- Agent 工具: 编排 Sub Agents
|
||||
```
|
||||
|
||||
### 步骤 4: 配置 Superpowers Skills
|
||||
|
||||
确保已安装以下 Skills:
|
||||
|
||||
```bash
|
||||
# 查看已安装的 Skills
|
||||
ls ~/.claude/skills/
|
||||
|
||||
# 如需安装 Superpowers
|
||||
# 参考 Superpowers Marketplace
|
||||
```
|
||||
|
||||
### 步骤 5: 验证部署
|
||||
|
||||
#### 5.1 测试 Gitea 连接
|
||||
|
||||
```bash
|
||||
# 在 Claude Code 中测试
|
||||
claude "测试 Gitea 连接"
|
||||
```
|
||||
|
||||
#### 5.2 测试规则生成
|
||||
|
||||
```javascript
|
||||
// 在 Claude Code 中
|
||||
import { generateGiteaRules } from '.claude/workflows/helpers/gitea-rules-generator.js'
|
||||
console.log(generateGiteaRules())
|
||||
```
|
||||
|
||||
#### 5.3 测试工作流
|
||||
|
||||
```javascript
|
||||
// 在 Claude Code 中
|
||||
Workflow({
|
||||
scriptPath: ".claude/workflows/gitea-orchestration.js",
|
||||
args: "实现用户登录功能"
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 工作流使用
|
||||
|
||||
### 基本用法
|
||||
|
||||
```javascript
|
||||
// 在 Claude Code 中
|
||||
Workflow({
|
||||
scriptPath: ".claude/workflows/gitea-orchestration.js",
|
||||
args: "任务描述"
|
||||
})
|
||||
```
|
||||
|
||||
### 高级用法
|
||||
|
||||
```javascript
|
||||
// 自定义配置
|
||||
Workflow({
|
||||
scriptPath: ".claude/workflows/gitea-orchestration.js",
|
||||
args: {
|
||||
task: "实现用户认证",
|
||||
options: {
|
||||
skipTest: false,
|
||||
reviewers: 2
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 目录结构
|
||||
|
||||
```
|
||||
sanguo_moziplus_v3/
|
||||
├── .claude/
|
||||
│ ├── CLAUDE.md # Main Agent 配置
|
||||
│ ├── gitea-config.json # Gitea 配置
|
||||
│ └── workflows/
|
||||
│ ├── gitea-orchestration.js # 主工作流
|
||||
│ ├── helpers/
|
||||
│ │ └── gitea-rules-generator.js # 规则生成器
|
||||
│ └── plan-execute-review.js # 备用工作流
|
||||
├── docs/
|
||||
│ └── design/
|
||||
│ └── 06-design-v0.5-dynamic-orchestration.md
|
||||
└── scripts/
|
||||
└── init.sh # 初始化脚本
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 配置文件详解
|
||||
|
||||
### gitea-config.json
|
||||
|
||||
```json
|
||||
{
|
||||
"gitea": {
|
||||
"baseUrl": "Gitea 服务器地址",
|
||||
"owner": "仓库所有者",
|
||||
"repo": "仓库名称",
|
||||
"defaultBranch": "主分支"
|
||||
},
|
||||
"rules": {
|
||||
"branchNaming": {
|
||||
"feature": "feature/{任务名}",
|
||||
"fix": "fix/{issue号}-{描述}",
|
||||
"hotfix": "hotfix/{描述}"
|
||||
},
|
||||
"commitNaming": {
|
||||
"feat": "feat: {描述}",
|
||||
"fix": "fix: {描述}",
|
||||
"refactor": "refactor: {描述}"
|
||||
},
|
||||
"prTemplate": {
|
||||
"title": "{类型}: {描述}",
|
||||
"description": "完整描述模板"
|
||||
}
|
||||
},
|
||||
"review": {
|
||||
"checklist": ["检查项1", "检查项2"],
|
||||
"approval": "批准规则"
|
||||
},
|
||||
"agents": {
|
||||
"main": { "role": "编排者" },
|
||||
"execute": { "role": "执行者" },
|
||||
"review": { "role": "审查者" },
|
||||
"test": { "role": "测试者" }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 初始化脚本
|
||||
|
||||
创建 `scripts/init.sh`:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# sanguo_moziplus_v3 初始化脚本
|
||||
|
||||
set -e
|
||||
|
||||
echo "=== sanguo_moziplus_v3 v0.5 初始化 ==="
|
||||
|
||||
# 1. 检查环境
|
||||
echo "检查环境..."
|
||||
command -v claude >/dev/null 2>&1 || { echo "❌ Claude Code 未安装"; exit 1; }
|
||||
command -v git >/dev/null 2>&1 || { echo "❌ Git 未安装"; exit 1; }
|
||||
command -v node >/dev/null 2>&1 || { echo "⚠️ Node.js 未安装 (可选)" }
|
||||
|
||||
# 2. 创建必要目录
|
||||
echo "创建目录..."
|
||||
mkdir -p .claude/workflows/helpers
|
||||
mkdir -p scripts
|
||||
|
||||
# 3. 检查配置文件
|
||||
echo "检查配置..."
|
||||
if [ ! -f .claude/gitea-config.json ]; then
|
||||
echo "❌ gitea-config.json 不存在"
|
||||
echo "请创建 .claude/gitea-config.json 配置文件"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 4. 检查 Claude Code 配置
|
||||
echo "检查 Claude Code 配置..."
|
||||
if [ ! -f ~/.claude/settings.json ]; then
|
||||
echo "❌ ~/.claude/settings.json 不存在"
|
||||
echo "请配置 GLM-5.2 端点"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 5. 验证 Gitea 连接
|
||||
echo "验证 Gitea 连接..."
|
||||
GITEA_URL=$(node -e "
|
||||
const fs = require('fs');
|
||||
const config = JSON.parse(fs.readFileSync('.claude/gitea-config.json', 'utf-8'));
|
||||
console.log(config.gitea.baseUrl);
|
||||
")
|
||||
echo "Gitea URL: $GITEA_URL"
|
||||
|
||||
# 6. 测试 Git 连接
|
||||
echo "测试 Git 连接..."
|
||||
git remote -v
|
||||
|
||||
echo "=== 初始化完成 ==="
|
||||
echo ""
|
||||
echo "下一步:"
|
||||
echo "1. 启动 Claude Code: claude"
|
||||
echo "2. 测试工作流: Workflow({ scriptPath: '.claude/workflows/gitea-orchestration.js', args: '测试任务' })"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 故障排查
|
||||
|
||||
### 问题 1: Gitea 连接失败
|
||||
|
||||
**检查**:
|
||||
1. 确认 gitea-config.json 配置正确
|
||||
2. 检查网络连接
|
||||
3. 验证 Gitea 服务器可访问
|
||||
|
||||
### 问题 2: 工作流无法运行
|
||||
|
||||
**检查**:
|
||||
1. 确认 Claude Code 版本支持 Workflow 工具
|
||||
2. 检查工作流文件路径
|
||||
3. 查看 Claude Code 日志
|
||||
|
||||
### 问题 3: Sub Agent 无法访问 Gitea
|
||||
|
||||
**检查**:
|
||||
1. 确认 Git 凭证配置
|
||||
2. 检查 Gitea 权限
|
||||
3. 验证 SSH/HTTPS 访问
|
||||
|
||||
---
|
||||
|
||||
## 升级指南
|
||||
|
||||
### 从 v0.4 升级
|
||||
|
||||
v0.4 使用三实例方案,v0.5 使用 Main + Sub Agent:
|
||||
|
||||
1. **保留**:
|
||||
- GLM-5.2 配置
|
||||
- Superpowers Skills
|
||||
- 角色 Skills
|
||||
|
||||
2. **移除**:
|
||||
- tmux 三实例配置
|
||||
- 启动脚本 (如不需要)
|
||||
|
||||
3. **新增**:
|
||||
- gitea-config.json
|
||||
- gitea-orchestration.js
|
||||
- gitea-rules-generator.js
|
||||
|
||||
4. **迁移**:
|
||||
- 更新 CLAUDE.md 为 Main Agent 配置
|
||||
- 使用 Gitea 协作替代 SendMessage
|
||||
|
||||
---
|
||||
|
||||
## 生产部署
|
||||
|
||||
### 使用 systemd (Linux)
|
||||
|
||||
创建 `/etc/systemd/system/sanguo.service`:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=sanguo_moziplus_v3 Development Environment
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=your-user
|
||||
WorkingDirectory=/path/to/sanguo_moziplus_v3
|
||||
ExecStart=/usr/local/bin/claude
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
### 使用 launchd (macOS)
|
||||
|
||||
创建 `~/Library/LaunchAgents/com.sanguo.dev.plist`:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.sanguo.dev</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/usr/local/bin/claude</string>
|
||||
</array>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>/path/to/sanguo_moziplus_v3</string>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [v0.5 设计文档](./docs/design/06-design-v0.5-dynamic-orchestration.md)
|
||||
- [Gitea 配置示例](./.claude/gitea-config.json)
|
||||
- [工作流脚本](./.claude/workflows/gitea-orchestration.js)
|
||||
|
||||
---
|
||||
|
||||
**文档版本**: v0.5
|
||||
**最后更新**: 2026-07-01
|
||||
**作者**: Claude Dev
|
||||
**状态**: Draft
|
||||
Executable
+238
@@ -0,0 +1,238 @@
|
||||
#!/bin/bash
|
||||
# sanguo_moziplus_v3 v0.5 初始化脚本
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
# 颜色定义
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${GREEN}=== sanguo_moziplus_v3 v0.5 初始化 ===${NC}"
|
||||
|
||||
# 1. 检查环境
|
||||
echo -e "\n${BLUE}1. 检查环境...${NC}"
|
||||
|
||||
if ! command -v claude &> /dev/null; then
|
||||
echo -e "${RED}❌ Claude Code 未安装${NC}"
|
||||
echo "请先安装 Claude Code: https://claude.ai/code"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${GREEN}✅ Claude Code 已安装${NC}"
|
||||
|
||||
if ! command -v git &> /dev/null; then
|
||||
echo -e "${RED}❌ Git 未安装${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${GREEN}✅ Git 已安装${NC}"
|
||||
|
||||
# Node.js 是可选的(用于运行 JS 工作流)
|
||||
if command -v node &> /dev/null; then
|
||||
echo -e "${GREEN}✅ Node.js 已安装: $(node --version)${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ Node.js 未安装 (可选,用于运行 JavaScript 工作流)${NC}"
|
||||
fi
|
||||
|
||||
# 2. 创建必要目录
|
||||
echo -e "\n${BLUE}2. 创建目录...${NC}"
|
||||
mkdir -p "$PROJECT_DIR/.claude/workflows/helpers"
|
||||
mkdir -p "$PROJECT_DIR/scripts"
|
||||
echo -e "${GREEN}✅ 目录创建完成${NC}"
|
||||
|
||||
# 3. 检查配置文件
|
||||
echo -e "\n${BLUE}3. 检查配置文件...${NC}"
|
||||
|
||||
if [ ! -f "$PROJECT_DIR/.claude/gitea-config.json" ]; then
|
||||
echo -e "${YELLOW}⚠️ gitea-config.json 不存在${NC}"
|
||||
echo "创建默认配置..."
|
||||
cat > "$PROJECT_DIR/.claude/gitea-config.json" << 'EOF'
|
||||
{
|
||||
"gitea": {
|
||||
"baseUrl": "http://192.168.2.154:3000",
|
||||
"owner": "sanguo",
|
||||
"repo": "sanguo_moziplus_v3",
|
||||
"defaultBranch": "main"
|
||||
},
|
||||
"rules": {
|
||||
"branchNaming": {
|
||||
"feature": "feature/{task-name}",
|
||||
"fix": "fix/{issue-number}-{description}",
|
||||
"hotfix": "hotfix/{description}"
|
||||
},
|
||||
"commitNaming": {
|
||||
"feature": "feat: {description}",
|
||||
"fix": "fix: {description}",
|
||||
"refactor": "refactor: {description}",
|
||||
"docs": "docs: {description}",
|
||||
"test": "test: {description}"
|
||||
},
|
||||
"prTemplate": {
|
||||
"title": "{task-type}: {description}",
|
||||
"description": "## 任务\n\n{task-description}\n\n## 技术方案\n\n{approach}\n\n## 实现内容\n\n{changes}\n\n## 测试\n\n{tests}"
|
||||
}
|
||||
},
|
||||
"review": {
|
||||
"checklist": [
|
||||
"代码质量",
|
||||
"安全性",
|
||||
"性能",
|
||||
"测试覆盖",
|
||||
"文档完整性"
|
||||
],
|
||||
"approval": "至少 2 个 Reviewer 通过"
|
||||
},
|
||||
"agents": {
|
||||
"main": {
|
||||
"role": "编排者",
|
||||
"responsibilities": [
|
||||
"分析任务",
|
||||
"安排 Sub Agents",
|
||||
"验收整合",
|
||||
"合并 PR"
|
||||
]
|
||||
},
|
||||
"execute": {
|
||||
"role": "执行者",
|
||||
"responsibilities": [
|
||||
"实现功能",
|
||||
"编写测试",
|
||||
"创建 PR"
|
||||
],
|
||||
"skills": ["backend-dev", "frontend-dev"]
|
||||
},
|
||||
"review": {
|
||||
"role": "审查者",
|
||||
"responsibilities": [
|
||||
"代码审查",
|
||||
"添加 Review 评论",
|
||||
"提供修改建议"
|
||||
],
|
||||
"skills": ["CODE-REVIEW", "security-reviewer"]
|
||||
},
|
||||
"test": {
|
||||
"role": "测试者",
|
||||
"responsibilities": [
|
||||
"编写测试",
|
||||
"执行测试",
|
||||
"验证修复"
|
||||
],
|
||||
"skills": ["test-engineer", "e2e-tester"]
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo -e "${GREEN}✅ 已创建默认配置${NC}"
|
||||
echo -e "${YELLOW}⚠️ 请编辑 .claude/gitea-config.json 配置你的 Gitea 信息${NC}"
|
||||
else
|
||||
echo -e "${GREEN}✅ gitea-config.json 已存在${NC}"
|
||||
fi
|
||||
|
||||
# 4. 检查 Claude Code 配置
|
||||
echo -e "\n${BLUE}4. 检查 Claude Code 配置...${NC}"
|
||||
|
||||
if [ ! -f "$HOME/.claude/settings.json" ]; then
|
||||
echo -e "${YELLOW}⚠️ ~/.claude/settings.json 不存在${NC}"
|
||||
echo "请配置 GLM-5.2 端点:"
|
||||
echo ""
|
||||
cat << 'EOF'
|
||||
{
|
||||
"env": {
|
||||
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
|
||||
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
|
||||
"ANTHROPIC_API_KEY": "你的智谱API_Key",
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.2[1m]",
|
||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.2[1m]"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo ""
|
||||
echo "创建配置文件:"
|
||||
echo " mkdir -p ~/.claude"
|
||||
echo " vim ~/.claude/settings.json"
|
||||
else
|
||||
echo -e "${GREEN}✅ ~/.claude/settings.json 已存在${NC}"
|
||||
fi
|
||||
|
||||
# 5. 读取并显示 Gitea 配置
|
||||
echo -e "\n${BLUE}5. Gitea 配置...${NC}"
|
||||
|
||||
if [ -f "$PROJECT_DIR/.claude/gitea-config.json" ]; then
|
||||
if command -v node &> /dev/null; then
|
||||
GITEA_CONFIG=$(node -e "
|
||||
const fs = require('fs');
|
||||
const config = JSON.parse(fs.readFileSync('$PROJECT_DIR/.claude/gitea-config.json', 'utf-8'));
|
||||
console.log(' Base URL: ' + config.gitea.baseUrl);
|
||||
console.log(' Owner: ' + config.gitea.owner);
|
||||
console.log(' Repository: ' + config.gitea.repo);
|
||||
console.log(' 主分支: ' + config.gitea.defaultBranch);
|
||||
" 2>/dev/null || echo " 无法解析配置文件")
|
||||
echo -e "$GITEA_CONFIG"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ 需要 Node.js 来解析配置${NC}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# 6. 测试 Git 连接
|
||||
echo -e "\n${BLUE}6. 测试 Git 连接...${NC}"
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
if git remote -v &> /dev/null; then
|
||||
echo "Git 远程仓库:"
|
||||
git remote -v
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ 没有配置 Git 远程仓库${NC}"
|
||||
echo "添加远程仓库:"
|
||||
echo " git remote add origin <your-gitea-url>"
|
||||
fi
|
||||
|
||||
# 7. 检查 Superpowers Skills
|
||||
echo -e "\n${BLUE}7. 检查 Superpowers Skills...${NC}"
|
||||
|
||||
SKILLS_DIR="$HOME/.claude/skills"
|
||||
if [ -d "$SKILLS_DIR" ]; then
|
||||
SKILL_COUNT=$(ls -1 "$SKILLS_DIR" 2>/dev/null | wc -l)
|
||||
echo -e "${GREEN}✅ Superpowers Skills 已安装: $SKILL_COUNT 个技能${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ Superpowers Skills 未安装${NC}"
|
||||
echo "请从 Superpowers Marketplace 安装所需技能"
|
||||
fi
|
||||
|
||||
# 8. 验证工作流文件
|
||||
echo -e "\n${BLUE}8. 验证工作流文件...${NC}"
|
||||
|
||||
WORKFLOW_FILES=(
|
||||
".claude/workflows/gitea-orchestration.js"
|
||||
".claude/workflows/helpers/gitea-rules-generator.js"
|
||||
)
|
||||
|
||||
for file in "${WORKFLOW_FILES[@]}"; do
|
||||
if [ -f "$PROJECT_DIR/$file" ]; then
|
||||
echo -e "${GREEN}✅ $file${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ $file 不存在${NC}"
|
||||
fi
|
||||
done
|
||||
|
||||
# 完成
|
||||
echo -e "\n${GREEN}=== 初始化完成 ===${NC}"
|
||||
echo ""
|
||||
echo -e "${BLUE}下一步操作:${NC}"
|
||||
echo "1. 编辑配置 (如需要):"
|
||||
echo " vim .claude/gitea-config.json"
|
||||
echo ""
|
||||
echo "2. 启动 Claude Code:"
|
||||
echo " cd $PROJECT_DIR"
|
||||
echo " claude"
|
||||
echo ""
|
||||
echo "3. 测试工作流:"
|
||||
echo " 在 Claude Code 中运行:"
|
||||
echo " Workflow({ scriptPath: '.claude/workflows/gitea-orchestration.js', args: '测试任务' })"
|
||||
echo ""
|
||||
echo -e "${BLUE}相关文档:${NC}"
|
||||
echo "- 部署指南: docs/deployment-v0.5.md"
|
||||
echo "- 设计文档: docs/design/06-design-v0.5-dynamic-orchestration.md"
|
||||
Reference in New Issue
Block a user