@boyingliu01/xp-gate 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapters/cpp.sh +3 -3
- package/adapters/dart.sh +2 -2
- package/adapters/flutter.sh +2 -2
- package/adapters/java.sh +4 -4
- package/adapters/kotlin.sh +4 -4
- package/adapters/objectivec.sh +2 -2
- package/adapters/plugins/p3c-java/scripts/install-maven-p3c.sh +3 -3
- package/adapters/plugins/whalecloud-java/scripts/install-maven-whalecloud.sh +3 -3
- package/adapters/powershell.sh +3 -3
- package/adapters/python.sh +2 -2
- package/adapters/shell.sh +3 -3
- package/adapters/swift.sh +2 -2
- package/package.json +1 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/admin-template-guidelines/SKILL.md +6 -797
- package/plugins/claude-code/skills/admin-template-guidelines/references/rule-1.md +91 -0
- package/plugins/claude-code/skills/admin-template-guidelines/references/rule-2.md +155 -0
- package/plugins/claude-code/skills/admin-template-guidelines/references/rule-3.md +70 -0
- package/plugins/claude-code/skills/admin-template-guidelines/references/rule-4.md +154 -0
- package/plugins/claude-code/skills/admin-template-guidelines/references/rule-5.md +126 -0
- package/plugins/claude-code/skills/admin-template-guidelines/references/rule-6.md +180 -0
- package/plugins/claude-code/skills/delphi-review/SKILL.md +59 -361
- package/plugins/claude-code/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
- package/plugins/claude-code/skills/delphi-review/references/round-templates.md +67 -0
- package/plugins/claude-code/skills/ralph-loop/SKILL.md +87 -429
- package/plugins/claude-code/skills/ralph-loop/references/components.md +113 -0
- package/plugins/claude-code/skills/ralph-loop/references/workflow-details.md +99 -0
- package/plugins/claude-code/skills/test-specification-alignment/SKILL.md +97 -599
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/skills/admin-template-guidelines/SKILL.md +6 -797
- package/plugins/opencode/skills/admin-template-guidelines/references/rule-1.md +91 -0
- package/plugins/opencode/skills/admin-template-guidelines/references/rule-2.md +155 -0
- package/plugins/opencode/skills/admin-template-guidelines/references/rule-3.md +70 -0
- package/plugins/opencode/skills/admin-template-guidelines/references/rule-4.md +154 -0
- package/plugins/opencode/skills/admin-template-guidelines/references/rule-5.md +126 -0
- package/plugins/opencode/skills/admin-template-guidelines/references/rule-6.md +180 -0
- package/plugins/opencode/skills/delphi-review/SKILL.md +59 -361
- package/plugins/opencode/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
- package/plugins/opencode/skills/delphi-review/references/round-templates.md +67 -0
- package/plugins/opencode/skills/ralph-loop/SKILL.md +87 -429
- package/plugins/opencode/skills/ralph-loop/references/components.md +113 -0
- package/plugins/opencode/skills/ralph-loop/references/workflow-details.md +99 -0
- package/plugins/opencode/skills/test-specification-alignment/SKILL.md +97 -599
- package/skills/admin-template-guidelines/SKILL.md +6 -797
- package/skills/admin-template-guidelines/references/rule-1.md +91 -0
- package/skills/admin-template-guidelines/references/rule-2.md +155 -0
- package/skills/admin-template-guidelines/references/rule-3.md +70 -0
- package/skills/admin-template-guidelines/references/rule-4.md +154 -0
- package/skills/admin-template-guidelines/references/rule-5.md +126 -0
- package/skills/admin-template-guidelines/references/rule-6.md +180 -0
- package/skills/delphi-review/SKILL.md +59 -361
- package/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
- package/skills/delphi-review/references/round-templates.md +67 -0
- package/skills/ralph-loop/SKILL.md +87 -429
- package/skills/ralph-loop/references/components.md +113 -0
- package/skills/ralph-loop/references/workflow-details.md +99 -0
- package/skills/test-specification-alignment/SKILL.md +97 -599
- package/plugins/claude-code/skills/ralph-loop/references/components/memory.md +0 -55
- package/plugins/claude-code/skills/ralph-loop/references/components/middleware.md +0 -54
- package/plugins/claude-code/skills/ralph-loop/references/components/skill-invocations.md +0 -39
- package/plugins/claude-code/skills/ralph-loop/references/components/system-prompt.md +0 -24
- package/plugins/claude-code/skills/ralph-loop/references/components/tool-descriptions.md +0 -32
- package/plugins/opencode/skills/ralph-loop/references/components/memory.md +0 -55
- package/plugins/opencode/skills/ralph-loop/references/components/middleware.md +0 -54
- package/plugins/opencode/skills/ralph-loop/references/components/skill-invocations.md +0 -39
- package/plugins/opencode/skills/ralph-loop/references/components/system-prompt.md +0 -24
- package/plugins/opencode/skills/ralph-loop/references/components/tool-descriptions.md +0 -32
- package/skills/ralph-loop/references/components/memory.md +0 -55
- package/skills/ralph-loop/references/components/middleware.md +0 -54
- package/skills/ralph-loop/references/components/skill-invocations.md +0 -39
- package/skills/ralph-loop/references/components/system-prompt.md +0 -24
- package/skills/ralph-loop/references/components/tool-descriptions.md +0 -32
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Ralph Loop 组件分解
|
|
2
|
+
|
|
3
|
+
## 1. System Prompt — 核心原则
|
|
4
|
+
|
|
5
|
+
| # | 原则 | 说明 |
|
|
6
|
+
|---|------|------|
|
|
7
|
+
| 1 | 逐 REQ 迭代 | 一次处理一个 REQ/切片,干净上下文,避免上下文线性膨胀 |
|
|
8
|
+
| 2 | Token 节约 | 比旧并行模式节约 40-67% token |
|
|
9
|
+
| 3 | 全量回归 | 每个 REQ 完成后跑全量测试 |
|
|
10
|
+
| 4 | 进度持久化 | progress.log 持久化 learnings/permanent/contextual |
|
|
11
|
+
| 5 | 可中断续传 | 中断后可从最后完成 REQ 继续 |
|
|
12
|
+
|
|
13
|
+
## 2. Memory — 状态与记忆结构
|
|
14
|
+
|
|
15
|
+
### Progress Log Schema (`progress.log` — YAML)
|
|
16
|
+
|
|
17
|
+
```yaml
|
|
18
|
+
req_progress:
|
|
19
|
+
completed_count: 3
|
|
20
|
+
total_count: 5
|
|
21
|
+
current_req: REQ-XXX-004
|
|
22
|
+
status: running|completed|blocked
|
|
23
|
+
test_infra_status: generated|existing|skipped|fallback
|
|
24
|
+
|
|
25
|
+
learnings:
|
|
26
|
+
permanent:
|
|
27
|
+
- pattern: "描述持久模式"
|
|
28
|
+
evidence: "来源证据"
|
|
29
|
+
contextual:
|
|
30
|
+
- pattern: "描述当前 REQ 有效模式"
|
|
31
|
+
expires_on: "过期条件"
|
|
32
|
+
|
|
33
|
+
cost:
|
|
34
|
+
req_number: 3
|
|
35
|
+
tokens_used: 15000
|
|
36
|
+
cumulative_tokens: 85000
|
|
37
|
+
threshold: 200000
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Test Infra Status 字段
|
|
41
|
+
|
|
42
|
+
| 值 | 含义 |
|
|
43
|
+
|---|------|
|
|
44
|
+
| `generated` | 本 REQ 首次生成 test-utils.ts |
|
|
45
|
+
| `existing` | test-utils.ts 已存在且接口完整 |
|
|
46
|
+
| `skipped` | 非首次 REQ,跳过 test-infra 检查 |
|
|
47
|
+
| `fallback` | test-infra dispatch 失败,使用 inline 生成 |
|
|
48
|
+
|
|
49
|
+
### Learnings 分类
|
|
50
|
+
|
|
51
|
+
| 类型 | 生命周期 | 示例 |
|
|
52
|
+
|------|---------|------|
|
|
53
|
+
| `permanent` | 跨所有 REQ | "项目使用 ESLint strict 模式" |
|
|
54
|
+
| `contextual` | 当前 REQ 内 | "REQ 003 使用 Zod 验证 schema" |
|
|
55
|
+
|
|
56
|
+
## 3. Middleware — 迭代控制逻辑
|
|
57
|
+
|
|
58
|
+
### 状态机
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
REQ N → 加载 learnings → 测试基础设施检查 → [infra missing?] → test_infra_dispatch
|
|
62
|
+
│ │ │
|
|
63
|
+
│ │ infra ready │ FAIL (max 2 retry)
|
|
64
|
+
│ ▼ ▼
|
|
65
|
+
│ TDD → 回归测试 ←───────────── BLOCK/fallback
|
|
66
|
+
│ │
|
|
67
|
+
│ PASS → REQ N+1
|
|
68
|
+
│ FAIL → 重试 (max 3) → BLOCK → 用户决策
|
|
69
|
+
│ ALL_REQS_COMPLETE → 结束,返回控制权给 sprint-flow orchestrator
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 熔断机制
|
|
73
|
+
|
|
74
|
+
| 触发条件 | 动作 |
|
|
75
|
+
|---------|------|
|
|
76
|
+
| TDD 失败 > 3 次 | BLOCK + 用户决策 |
|
|
77
|
+
| Token 使用超阈值 | BLOCK + 用户决策 |
|
|
78
|
+
| 回归测试失败 | 记录到 progress.log,通知 orchestrator |
|
|
79
|
+
| test-infra dispatch 失败 (max 2 retry) | BLOCK 或 fallback inline 生成 |
|
|
80
|
+
|
|
81
|
+
## 4. Skill Invocations — 技能调用链
|
|
82
|
+
|
|
83
|
+
| 步骤 | Skill | 参数 |
|
|
84
|
+
|------|-------|------|
|
|
85
|
+
| 0 | 测试基础设施检查 | 检查 test-utils.ts 存在性 + 接口契约 |
|
|
86
|
+
| 1 | `test-driven-development` | `--lang` 注入 + TDD 铁律 + Mock 边界 |
|
|
87
|
+
| 2 | `learn` (gstack) | classification: permanent/contextual |
|
|
88
|
+
| 3 | `requesting-code-review` | REQ 完成后评审 |
|
|
89
|
+
|
|
90
|
+
### test-infra dispatch 节点
|
|
91
|
+
|
|
92
|
+
当 test-utils.ts 不存在或接口缺失时:
|
|
93
|
+
```
|
|
94
|
+
task(category="unspecified-high", load_skills=["test-driven-development"],
|
|
95
|
+
prompt="生成测试基础设施:createTestApp() + withTestDb()。TDD 铁律:先写测试再实现。")
|
|
96
|
+
```
|
|
97
|
+
- retry max 2 次
|
|
98
|
+
- 仍失败 → BLOCK 或 fallback inline 生成(记录 warning)
|
|
99
|
+
- 成功后与业务代码合并为同一 commit
|
|
100
|
+
|
|
101
|
+
## 5. Tool Descriptions — 构建步骤
|
|
102
|
+
|
|
103
|
+
| 步骤 | 动作 | 说明 |
|
|
104
|
+
|------|------|------|
|
|
105
|
+
| 1 | 加载当前 REQ | 从 specification.yaml 获取下一个 READY REQ |
|
|
106
|
+
| 2 | 加载 learnings | 从 progress.log 加载 permanent + contextual learnings |
|
|
107
|
+
| 3 | 测试基础设施检查 | 检查 test-utils.ts。不存在 → dispatch, retry max 2 |
|
|
108
|
+
| 4 | TDD (RED→GREEN→REFACTOR) | test-driven-development skill |
|
|
109
|
+
| 5 | 全量回归测试 | 运行全部现有测试 |
|
|
110
|
+
| 6 | 测试先行比率检查 (L1b) | 新增测试行数 / 总新增行数 ≥ 40% |
|
|
111
|
+
| 7 | 记录 progress.log | learnings 分类存储 |
|
|
112
|
+
| 8 | 成本检查 | token 使用量是否超阈值 |
|
|
113
|
+
| 9 | 完成/继续 | 所有 REQ 完成 → 结束;否则 → 下一个 |
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Ralph Loop Workflow Details
|
|
2
|
+
|
|
3
|
+
## Mandatory Execution Order
|
|
4
|
+
|
|
5
|
+
每个 REQ 必须按以下顺序执行,不得跳过或重排:
|
|
6
|
+
|
|
7
|
+
### 1. Load next READY REQ
|
|
8
|
+
- 从 specification.yaml 读取下一个依赖已满足的 REQ
|
|
9
|
+
- 检查 priority 和 status (pending 状态)
|
|
10
|
+
- 构建依赖图,确认无循环依赖
|
|
11
|
+
|
|
12
|
+
### 2. Create isolated context
|
|
13
|
+
- 清空前一个 REQ 的对话历史
|
|
14
|
+
- 注入:当前 REQ + AC + permanent learnings + contextual learnings (最近 3 条)
|
|
15
|
+
- 注入:AGENTS.md + git log --oneline -5 + 测试基础设施摘要
|
|
16
|
+
|
|
17
|
+
### 3. Pre-REQ snapshot(Issue #137)
|
|
18
|
+
在 dispatch subagent 前记录当前 git HEAD,用于 TDD 合规的基线对比:
|
|
19
|
+
```bash
|
|
20
|
+
PRE_REQ_HASH=$(git rev-parse HEAD)
|
|
21
|
+
echo "$PRE_REQ_HASH" > .sprint-state/last-req-baseline.txt
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 4. Dispatch build subagent
|
|
25
|
+
- 使用 `task(category="unspecified-high", load_skills=["test-driven-development"], timeout=300)`
|
|
26
|
+
- 强制 TDD 流程:RED → GREEN → REFACTOR
|
|
27
|
+
- 强制执行 Mock 边界策略
|
|
28
|
+
|
|
29
|
+
### 5. Run full regression tests
|
|
30
|
+
- **L1**: typecheck + lint on changed files
|
|
31
|
+
- **L1b**: 使用 git diff 验证新增测试行数占总新增行数比例 ≥ 40%
|
|
32
|
+
- **L1b-alt**: 当 diff 为空时,降级检查测试文件是否在 changeset 中
|
|
33
|
+
- **L2**: 全量测试运行(不只是 @test 当前 REQ 的测试)
|
|
34
|
+
- **L3**: 检查整体覆盖率 ≥ 80%
|
|
35
|
+
|
|
36
|
+
### 6. Fix until green or block
|
|
37
|
+
- 失败 → retry (max 3 次,每次注入失败摘要)
|
|
38
|
+
- 第 3 次仍失败 → BLOCK → 等待用户决策 (skip/manual/stop/rollback)
|
|
39
|
+
- 通过 → git commit + 标记 done
|
|
40
|
+
|
|
41
|
+
### 7. Persist learnings
|
|
42
|
+
- 分类为 permanent(架构级)或 contextual(临时性)
|
|
43
|
+
- 自动升级条件:被≥2 个 REQ 引用 或 涉及接口/数据结构
|
|
44
|
+
- 调用 `gstack/learn` 总结经验教训
|
|
45
|
+
|
|
46
|
+
### 8. Update sprint state
|
|
47
|
+
- orchestrator 统一更新 AGENTS.md(append `## ralph-loop: [REQ-XXX title]`)
|
|
48
|
+
- 原子写 checkpoint (progress.log)
|
|
49
|
+
- 继续下一个 READY REQ
|
|
50
|
+
|
|
51
|
+
### 禁止行为
|
|
52
|
+
- ❌ 跳过测试基础设施检查
|
|
53
|
+
- ❌ 只运行部分测试(必须全量回归)
|
|
54
|
+
- ❌ 验证失败仍 commit
|
|
55
|
+
- ❌ 多个 subagent 同时写 AGENTS.md
|
|
56
|
+
- ❌ 修改前一个 REQ 的代码(除非修复回归)
|
|
57
|
+
|
|
58
|
+
## Output Contract (Mandatory Checklist)
|
|
59
|
+
|
|
60
|
+
每个 REQ 完成时必须输出以下结构化检查清单:
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
## REQ-XXX: [Title] - Execution Summary
|
|
64
|
+
|
|
65
|
+
**Status**: ✅ PASS / ❌ FAIL (retry n/3) / 🚫 BLOCKED
|
|
66
|
+
|
|
67
|
+
**Context Isolation**:
|
|
68
|
+
- [ ] Previous REQ context cleared
|
|
69
|
+
- [ ] Permanent learnings injected (N items)
|
|
70
|
+
- [ ] Contextual learnings injected (≤3 items)
|
|
71
|
+
- [ ] Test infrastructure confirmed ready
|
|
72
|
+
|
|
73
|
+
**TDD Compliance**:
|
|
74
|
+
- [ ] Tests written BEFORE implementation
|
|
75
|
+
- [ ] Test/implementation ratio ≥ 40% (L1b)
|
|
76
|
+
- [ ] Mock usage justified (if >30% mock density)
|
|
77
|
+
- [ ] Test files present in changeset (L1b-alt)
|
|
78
|
+
- [ ] TDD 合规检查 (test-first or @no-test-required)
|
|
79
|
+
|
|
80
|
+
**Verification Layers**:
|
|
81
|
+
- [ ] L1: typecheck + lint pass
|
|
82
|
+
- [ ] L1b: Test-first ratio check pass
|
|
83
|
+
- [ ] L2: FULL regression tests (all tests)
|
|
84
|
+
- [ ] L3: coverage ≥ 80%
|
|
85
|
+
|
|
86
|
+
**Learnings Persisted**:
|
|
87
|
+
- [ ] Permanent: [N items]
|
|
88
|
+
- [ ] Contextual: [N items, sliding window]
|
|
89
|
+
- [ ] `gstack/learn` called
|
|
90
|
+
|
|
91
|
+
**State Updated**:
|
|
92
|
+
- [ ] AGENTS.md updated (orchestrator)
|
|
93
|
+
- [ ] progress.log atomically written
|
|
94
|
+
- [ ] Git commit created (if PASS)
|
|
95
|
+
|
|
96
|
+
**Next Step**: [REQ-YYY title / COMPLETE / BLOCKED]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Eval Criteria**: Structured execution plan visible, all 7 workflow steps followed, full regression tests run.
|