Loading...
Loading...
Compare original and translation side by side
What enhancement would you like to add? You can:
- Describe it in text
- Provide document path(s) with requirements
- Provide URL(s) with specifications你想要添加什么增强功能?你可以:
- 用文字描述
- 提供包含需求的文档路径
- 提供包含规格说明的URLundefinedundefined
**Step 2.2: Discover Project Structure**
```bash
**步骤2.2:探索项目结构**
```bash
Read package.json, pyproject.toml, or other config files to understand the stack.
**Step 2.3: Identify Tech Stack**
Determine:
- Programming language
- Framework (Express, FastAPI, Next.js, etc.)
- Database (if any)
- Testing framework
- Project conventions
**Step 2.4: Check for Existing Ralph Setup**
```bash
读取package.json、pyproject.toml或其他配置文件以了解技术栈。
**步骤2.3:确定技术栈**
确定以下内容:
- 编程语言
- 框架(Express、FastAPI、Next.js等)
- 数据库(如有)
- 测试框架
- 项目约定
**步骤2.4:检查现有Ralph设置**
```bash
If Ralph is NOT set up:
- Initialize ralph.db with schema
- Create PRD.md if missing
- Copy loop scripts from Ralph-Skill installation
- Copy dashboard.html for web visualization
**Copy required files if missing:**
**Unix:**
```bash
如果未设置Ralph:
- 使用schema.sql初始化ralph.db
- 若缺少PRD.md则创建该文件
- 从Ralph-Skill安装目录复制循环脚本
- 复制dashboard.html用于Web可视化
**复制缺失的必要文件:**
**Unix系统:**
```bash
**Windows:**
```powershell
$ralphPath = "$env:USERPROFILE\.claude\skills\ralph-new"
Copy-Item "$ralphPath\..\..\..\templates\schema.sql" templates\ -ErrorAction SilentlyContinue
Copy-Item "$ralphPath\..\..\..\scripts\ralph*.ps1" scripts\ -ErrorAction SilentlyContinue
Copy-Item "$ralphPath\..\..\..\templates\dashboard.html" . -ErrorAction SilentlyContinuecurl -sO https://raw.githubusercontent.com/kroegha/Ralph-Skill/main/templates/dashboard.html
curl -sO https://raw.githubusercontent.com/kroegha/Ralph-Skill/main/templates/schema.sqlcat PRD.md 2>/dev/null
**Windows系统:**
```powershell
$ralphPath = "$env:USERPROFILE\.claude\skills\ralph-new"
Copy-Item "$ralphPath\..\..\..\templates\schema.sql" templates\ -ErrorAction SilentlyContinue
Copy-Item "$ralphPath\..\..\..\scripts\ralph*.ps1" scripts\ -ErrorAction SilentlyContinue
Copy-Item "$ralphPath\..\..\..\templates\dashboard.html" . -ErrorAction SilentlyContinuecurl -sO https://raw.githubusercontent.com/kroegha/Ralph-Skill/main/templates/dashboard.html
curl -sO https://raw.githubusercontent.com/kroegha/Ralph-Skill/main/templates/schema.sqlcat PRD.md 2>/dev/nullmkdir -p docs/enhancementsdocs/enhancements/ENH-XXX.mdundefinedmkdir -p docs/enhancementsdocs/enhancements/ENH-XXX.mdundefinedundefinedundefined------[
{"step": 1, "action": "navigate", "target": "/path"},
{"step": 2, "action": "click", "target": "selector"},
{"step": 3, "action": "verify", "target": "text", "expected": "result"}
]undefined[
{"step": 1, "action": "navigate", "target": "/path"},
{"step": 2, "action": "click", "target": "selector"},
{"step": 3, "action": "verify", "target": "text", "expected": "result"}
]undefinedsqlite3 ralph.db "INSERT INTO tasks (task_id, name, type, status) VALUES ('US-XXX', 'Story title', 'enhancement', 'planned');"sqlite3 ralph.db "SELECT task_id, name, status FROM tasks WHERE status='planned';"sqlite3 ralph.db "INSERT INTO tasks (task_id, name, type, status) VALUES ('US-XXX', 'Story title', 'enhancement', 'planned');"sqlite3 ralph.db "SELECT task_id, name, status FROM tasks WHERE status='planned';"// tests/e2e/enh-xxx.spec.ts
import { test, expect } from '@playwright/test';
test.describe('ENH-XXX: [Title]', () => {
test('US-XXX: [Story]', async ({ page }) => {
// Test implementation
});
});undefined// tests/e2e/enh-xxx.spec.ts
import { test, expect } from '@playwright/test';
test.describe('ENH-XXX: [Title]', () => {
test('US-XXX: [Story]', async ({ page }) => {
// 测试实现代码
});
});undefinedundefinedundefinedWHILE there are pending enhancement tasks in ralph.db:
1. Get next task:
TASK_ID=$(sqlite3 ralph.db "SELECT task_id FROM tasks WHERE status='planned' AND type='enhancement' ORDER BY priority LIMIT 1;")
2. If no task, check for in-progress:
TASK_ID=$(sqlite3 ralph.db "SELECT task_id FROM tasks WHERE status='in-progress' ORDER BY started_at LIMIT 1;")
3. If still no task, ALL DONE - exit loop
4. Mark as in-progress:
sqlite3 ralph.db "UPDATE tasks SET status='in-progress', started_at=CURRENT_TIMESTAMP WHERE task_id='$TASK_ID';"
5. Read task details from PRD.md
6. IMPLEMENT the task:
- Write/modify code files
- Follow existing project patterns
- Create/update tests
7. RUN tests:
# Node.js
npx playwright test tests/e2e/enh-xxx.spec.ts
# OR Python
pytest tests/e2e/test_enh_xxx.py
8. IF tests pass:
- sqlite3 ralph.db "UPDATE tasks SET status='completed', completed_at=CURRENT_TIMESTAMP WHERE task_id='$TASK_ID';"
- Update PRD.md: change [ ] to [x] for this task
- git add . && git commit -m "Complete $TASK_ID: [description]"
9. IF tests fail:
- Append error to progress.txt with learnings
- sqlite3 ralph.db "UPDATE tasks SET iteration_count=iteration_count+1 WHERE task_id='$TASK_ID';"
- Check failure count:
FAILURES=$(sqlite3 ralph.db "SELECT iteration_count FROM tasks WHERE task_id='$TASK_ID';")
if [ $FAILURES -ge 3 ]; then
sqlite3 ralph.db "UPDATE tasks SET status='failed' WHERE task_id='$TASK_ID';"
fi
- Try different approach on next iteration
10. CONTINUE to next task
END WHILE$taskId = sqlite3 ralph.db "SELECT task_id FROM tasks WHERE status='planned' ORDER BY priority LIMIT 1;"
sqlite3 ralph.db "UPDATE tasks SET status='in-progress' WHERE task_id='$taskId';"
npx playwright test
git add . ; git commit -m "Complete ${taskId}"TASK_ID=$(sqlite3 ralph.db "SELECT task_id FROM tasks WHERE status='planned' ORDER BY priority LIMIT 1;")
sqlite3 ralph.db "UPDATE tasks SET status='in-progress' WHERE task_id='$TASK_ID';"
npx playwright test
git add . && git commit -m "Complete $TASK_ID"completedfailed<promise>COMPLETE</promise><promise>FAILED</promise>WHILE ralph.db中存在待处理的增强任务:
1. 获取下一个任务:
TASK_ID=$(sqlite3 ralph.db "SELECT task_id FROM tasks WHERE status='planned' AND type='enhancement' ORDER BY priority LIMIT 1;")
2. 如果没有任务,检查进行中的任务:
TASK_ID=$(sqlite3 ralph.db "SELECT task_id FROM tasks WHERE status='in-progress' ORDER BY started_at LIMIT 1;")
3. 如果仍无任务,全部完成 - 退出循环
4. 标记为进行中:
sqlite3 ralph.db "UPDATE tasks SET status='in-progress', started_at=CURRENT_TIMESTAMP WHERE task_id='$TASK_ID';"
5. 从PRD.md读取任务详情
6. 实现任务:
- 编写/修改代码文件
- 遵循现有项目模式
- 创建/更新测试
7. 运行测试:
# Node.js
npx playwright test tests/e2e/enh-xxx.spec.ts
# 或Python
pytest tests/e2e/test_enh_xxx.py
8. 如果测试通过:
- sqlite3 ralph.db "UPDATE tasks SET status='completed', completed_at=CURRENT_TIMESTAMP WHERE task_id='$TASK_ID';"
- 更新PRD.md: 将此任务的[ ]改为[x]
- git add . && git commit -m "Complete $TASK_ID: [description]"
9. 如果测试失败:
- 将错误及经验教训追加到progress.txt
- sqlite3 ralph.db "UPDATE tasks SET iteration_count=iteration_count+1 WHERE task_id='$TASK_ID';"
- 检查失败次数:
FAILURES=$(sqlite3 ralph.db "SELECT iteration_count FROM tasks WHERE task_id='$TASK_ID';")
if [ $FAILURES -ge 3 ]; then
sqlite3 ralph.db "UPDATE tasks SET status='failed' WHERE task_id='$TASK_ID';"
fi
- 在下一次循环中尝试不同的实现方式
10. 继续下一个任务
END WHILE$taskId = sqlite3 ralph.db "SELECT task_id FROM tasks WHERE status='planned' ORDER BY priority LIMIT 1;"
sqlite3 ralph.db "UPDATE tasks SET status='in-progress' WHERE task_id='$taskId';"
npx playwright test
git add . ; git commit -m "Complete ${taskId}"TASK_ID=$(sqlite3 ralph.db "SELECT task_id FROM tasks WHERE status='planned' ORDER BY priority LIMIT 1;")
sqlite3 ralph.db "UPDATE tasks SET status='in-progress' WHERE task_id='$TASK_ID';"
npx playwright test
git add . && git commit -m "Complete $TASK_ID"completedfailed<promise>COMPLETE</promise><promise>FAILED</promise>| Action | Windows (PowerShell) | Unix (Bash) |
|---|---|---|
| Create directory | | |
| Copy file | | |
| Check if file exists | | |
| Run SQLite | | |
| Run Playwright | | |
| Git commit | | |
| 操作 | Windows(PowerShell) | Unix(Bash) |
|---|---|---|
| 创建目录 | | |
| 复制文件 | | |
| 检查文件是否存在 | | |
| 运行SQLite | | |
| 运行Playwright | | |
| Git提交 | | |
<promise>COMPLETE</promise><promise>COMPLETE</promise>