shipgate-cli 0.0.0-stage → 0.2.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.
Files changed (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +261 -2
  3. package/agents/context-builder.md +158 -0
  4. package/agents/debug-executor.md +234 -0
  5. package/assets/gates/classifier.js +245 -0
  6. package/assets/gates/dsh/index.js +767 -0
  7. package/assets/gates/dsh/policy.json +93 -0
  8. package/assets/gates/index.js +3 -0
  9. package/assets/gates/pi/index.js +1131 -0
  10. package/assets/gates/pi/policy.json +93 -0
  11. package/assets/gates/policy.js +4267 -0
  12. package/assets/gates/profiles/ai4s-dry-lab.json +64 -0
  13. package/assets/gates/profiles/ai4s-quant.json +36 -0
  14. package/assets/pi-extensions/auto-continue.ts +176 -0
  15. package/assets/pi-extensions/goal-mode.ts +313 -0
  16. package/bin/shipgate.mjs +9 -0
  17. package/commands/ai-spec.md +9 -0
  18. package/commands/api-first.md +33 -0
  19. package/commands/code-review.md +7 -0
  20. package/commands/codebase-context.md +19 -0
  21. package/commands/debug-ui.md +147 -0
  22. package/commands/debug.md +101 -0
  23. package/commands/dev-env-scan.md +18 -0
  24. package/commands/dev-host-init.md +28 -0
  25. package/commands/discover-skill-opportunities.md +33 -0
  26. package/commands/fork-sync.md +17 -0
  27. package/commands/gh-actions.md +26 -0
  28. package/commands/goal-driven-development.md +7 -0
  29. package/commands/intent-grill.md +7 -0
  30. package/commands/iteration-manager.md +7 -0
  31. package/commands/loop-engineer.md +21 -0
  32. package/commands/nodejs-npm-auto-release.md +12 -0
  33. package/commands/prd.md +7 -0
  34. package/commands/project-health-audit.md +7 -0
  35. package/commands/ralph-yolo.md +346 -0
  36. package/commands/ralph.md +226 -0
  37. package/commands/security-audit.md +7 -0
  38. package/commands/ux-experience-audit.md +133 -0
  39. package/docs/ARCHITECTURE.md +63 -0
  40. package/docs/GATES.md +106 -0
  41. package/docs/HARNESS.md +257 -0
  42. package/package.json +48 -4
  43. package/references/ADR-FORMAT.md +67 -0
  44. package/references/CONTEXT-FORMAT.md +62 -0
  45. package/references/mcp-config-template.json +54 -0
  46. package/scripts/fix-skill-frontmatter.mjs +66 -0
  47. package/scripts/migrate-skillpack.mjs +257 -0
  48. package/skills/ai-spec/SKILL.md +90 -0
  49. package/skills/api-first-modular/SKILL.md +411 -0
  50. package/skills/code-debugger/SKILL.md +379 -0
  51. package/skills/code-review/SKILL.md +62 -0
  52. package/skills/codebase-context/SKILL.md +139 -0
  53. package/skills/debug-ui/SKILL.md +220 -0
  54. package/skills/dev-env-scan/SKILL.md +147 -0
  55. package/skills/dev-host-init/SKILL.md +198 -0
  56. package/skills/dev-host-init/scripts/fill-placeholders.py +226 -0
  57. package/skills/dev-host-init/scripts/host-scan.ps1 +159 -0
  58. package/skills/dev-host-init/scripts/host-scan.sh +201 -0
  59. package/skills/dev-host-init/scripts/render-now.py +488 -0
  60. package/skills/dev-host-init/scripts/tools-catalog.py +229 -0
  61. package/skills/dev-host-init/templates/graph-first-gate.ts +291 -0
  62. package/skills/dev-host-init/templates/host-injection.template.md +725 -0
  63. package/skills/discover-skill-opportunities/SKILL.md +145 -0
  64. package/skills/discover-skill-opportunities/references/accounting-finance-ops.md +24 -0
  65. package/skills/discover-skill-opportunities/references/business-consulting.md +24 -0
  66. package/skills/discover-skill-opportunities/references/evidence-and-privacy.md +39 -0
  67. package/skills/discover-skill-opportunities/references/finance-investment.md +24 -0
  68. package/skills/discover-skill-opportunities/references/legal-and-compliance.md +24 -0
  69. package/skills/discover-skill-opportunities/references/output-contract.md +75 -0
  70. package/skills/discover-skill-opportunities/references/product-and-operations.md +24 -0
  71. package/skills/discover-skill-opportunities/references/quant-trading.md +24 -0
  72. package/skills/discover-skill-opportunities/references/scientific-research.md +24 -0
  73. package/skills/discover-skill-opportunities/references/scoring-rubric.md +45 -0
  74. package/skills/discover-skill-opportunities/references/session-skill-review.md +78 -0
  75. package/skills/discover-skill-opportunities/references/software-development.md +24 -0
  76. package/skills/fork-sync/SKILL.md +86 -0
  77. package/skills/gh-actions-architect/SKILL.md +395 -0
  78. package/skills/goal-driven-development/SKILL.md +132 -0
  79. package/skills/intent-grill/SKILL.md +46 -0
  80. package/skills/iteration-manager/SKILL.md +53 -0
  81. package/skills/loop-engineer/SKILL.md +108 -0
  82. package/skills/nodejs-npm-auto-release/SKILL.md +141 -0
  83. package/skills/prd/SKILL.md +63 -0
  84. package/skills/project-health-audit/SKILL.md +64 -0
  85. package/skills/ralph/SKILL.md +329 -0
  86. package/skills/ralph-yolo/SKILL.md +623 -0
  87. package/skills/security-audit/SKILL.md +114 -0
  88. package/skills/security-audit/references/audit-checklist.md +135 -0
  89. package/skills/security-audit/references/evidence-conventions.md +54 -0
  90. package/skills/security-audit/references/findings-schema.md +37 -0
  91. package/skills/security-audit/references/stack-signatures.md +66 -0
  92. package/skills/shipgate/SKILL.md +40 -0
  93. package/skills/shipgate-install/SKILL.md +87 -0
  94. package/skills/shipgate-quality/SKILL.md +80 -0
  95. package/skills/shipgate-security/SKILL.md +97 -0
  96. package/skills/shipgate-spec/SKILL.md +67 -0
  97. package/skills/ux-experience-audit/SKILL.md +202 -0
  98. package/src/cli.mjs +118 -0
  99. package/src/commands/ask.mjs +82 -0
  100. package/src/commands/deploy.mjs +587 -0
  101. package/src/commands/gates.mjs +83 -0
  102. package/src/commands/policy.mjs +116 -0
  103. package/src/gates/quality.mjs +123 -0
  104. package/src/gates/security.mjs +92 -0
  105. package/src/gates/ship.mjs +74 -0
  106. package/src/gates/spec.mjs +88 -0
  107. package/src/harness/index.mjs +203 -0
  108. package/src/inject/render.mjs +75 -0
  109. package/src/lib/cfg.mjs +66 -0
  110. package/src/lib/duration.mjs +41 -0
  111. package/src/lib/engines.mjs +182 -0
  112. package/src/lib/exec.mjs +80 -0
  113. package/src/lib/fsx.mjs +119 -0
  114. package/src/lib/gate.mjs +329 -0
  115. package/src/lib/log.mjs +31 -0
  116. package/src/lib/skills.mjs +347 -0
  117. package/src/lib/state.mjs +50 -0
  118. package/src/lib/update.mjs +67 -0
  119. package/src/version.mjs +14 -0
  120. package/templates/agents-snippet.md +82 -0
  121. package/templates/dev-profile.schema.json +119 -0
  122. package/templates/prd.json.example +64 -0
  123. package/templates/rule.json.example +28 -0
@@ -0,0 +1,346 @@
1
+ ---
2
+ description: YOLO模式 - 直接使用Claude Code子Agent实现PRD,无需Amp CLI
3
+ ---
4
+
5
+ # Ralph YOLO - 自主 Agent 循环(无 Amp 依赖)
6
+
7
+ Ralph YOLO 是 Ralph 的轻量版本,直接使用 Claude Code 的 Task tool 管理子 agent 完成任务,无需 Amp CLI。
8
+
9
+ ---
10
+
11
+ ## 使用方法
12
+
13
+ ```
14
+ /ralph-yolo [path-to-prd.md]
15
+ ```
16
+
17
+ **示例:**
18
+ ```bash
19
+ /ralph-yolo tasks/prd-my-feature.md # 从 PRD 转换并执行
20
+ /ralph-yolo prd.json # 使用现有 prd.json 执行
21
+ /ralph-yolo # 自动查找 prd.json
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Phase 1: PRD 转换(如果提供 markdown PRD)
27
+
28
+ ### Step 1: 检查输入
29
+
30
+ 检查用户是否提供了 PRD 文件路径。如果没有,查找项目根目录的 `prd.json`。
31
+
32
+ **用户输入格式:**
33
+ - `/ralph-yolo tasks/prd-my-feature.md` - 转换 PRD 并运行 Ralph YOLO
34
+ - `/ralph-yolo prd.json` - 使用现有 prd.json 运行
35
+ - `/ralph-yolo` - 运行(查找 prd.json)
36
+
37
+ ### Step 2: 归档旧运行(如需要)
38
+
39
+ 检查是否存在 `prd.json` 且 `branchName` 不同。如果是:
40
+ 1. 读取当前 `prd.json` 提取 `branchName`
41
+ 2. 比较新功能的分支名
42
+ 3. 如果不同且 `prd-progress.txt` 有内容:
43
+ - 创建归档文件夹:`.claude/archive/YYYY-MM-DD-[feature-name]/`
44
+ - 复制当前 `prd.json` 和 `prd-progress.txt` 到归档
45
+ - 重置 `prd-progress.txt` 为新的头部信息
46
+
47
+ ### Step 3: 转换为 prd.json
48
+
49
+ 解析 PRD 并生成项目根目录的 `prd.json`:
50
+
51
+ ```json
52
+ {
53
+ "project": "[从 PRD 提取或自动检测的项目名]",
54
+ "branchName": "ralph/[feature-name-kebab-case]",
55
+ "description": "[从 PRD 提取的功能描述]",
56
+ "userStories": [
57
+ {
58
+ "id": "US-001",
59
+ "title": "[故事标题]",
60
+ "description": "As a [用户], I want [功能] so that [收益]",
61
+ "acceptanceCriteria": [
62
+ "标准 1",
63
+ "标准 2",
64
+ "Typecheck passes"
65
+ ],
66
+ "priority": 1,
67
+ "passes": false,
68
+ "notes": ""
69
+ }
70
+ ]
71
+ }
72
+ ```
73
+
74
+ ### 转换规则
75
+
76
+ 1. **每个用户故事成为一个 JSON 条目**
77
+ 2. **ID**:顺序编号(US-001, US-002 等)
78
+ 3. **Priority**:基于依赖顺序(schema → backend → UI)
79
+ 4. **所有故事**:初始 `passes: false`,`notes` 为空
80
+ 5. **branchName**:从功能名派生,kebab-case,前缀 `ralph/`
81
+ 6. **始终添加**:"Typecheck passes" 到每个故事
82
+ 7. **UI 故事**:添加 "Verify in browser"
83
+
84
+ ### 故事大小关键原则
85
+
86
+ 每个故事必须在一个上下文窗口内完成。
87
+
88
+ **合适大小:**
89
+ - 添加数据库列和迁移
90
+ - 向现有页面添加 UI 组件
91
+ - 更新服务器操作
92
+ - 添加过滤下拉菜单
93
+
94
+ **太大(需拆分):**
95
+ - "构建整个仪表板" → 拆分为:schema, queries, UI 组件, filters
96
+ - "添加认证" → 拆分为:schema, middleware, 登录 UI, session handling
97
+
98
+ **经验法则:** 如果不能用 2-3 句话描述变更,就太大了。
99
+
100
+ ### 故事排序
101
+
102
+ 故事按 `priority` 顺序执行。前面的故事不能依赖后面的。
103
+
104
+ **正确顺序:**
105
+ 1. Schema/数据库变更(migrations)
106
+ 2. Server actions / 后端逻辑
107
+ 3. 使用后端的 UI 组件
108
+ 4. 汇总数据的 Dashboard/summary 视图
109
+
110
+ ### 执行前验证
111
+
112
+ 运行 Ralph YOLO 前,验证:
113
+ - [ ] 旧运行已归档(如适用)
114
+ - [ ] 每个故事可在一个迭代内完成
115
+ - [ ] 故事按依赖关系排序
116
+ - [ ] 每个故事有 "Typecheck passes"
117
+ - [ ] UI 故事有 "Verify in browser"
118
+ - [ ] 验收标准可验证(不模糊)
119
+
120
+ ---
121
+
122
+ ## Phase 2: Ralph YOLO 执行
123
+
124
+ ### Step 1: 预检
125
+
126
+ 验证以下条件:
127
+
128
+ **1. Git 工作区干净**
129
+ ```bash
130
+ git status --porcelain
131
+ ```
132
+ 如果不干净,要求用户提交或暂存更改
133
+
134
+ **2. prd.json 存在且有效**
135
+ ```bash
136
+ cat prd.json | jq .
137
+ ```
138
+ 如果无效,显示错误并退出
139
+
140
+ ### Step 2: 创建或检出功能分支
141
+
142
+ 读取 `prd.json` 中的 `branchName`:
143
+ ```bash
144
+ jq -r '.branchName' prd.json
145
+ ```
146
+
147
+ 如果分支不存在,从 main 创建:
148
+ ```bash
149
+ git checkout -b $(jq -r '.branchName' prd.json)
150
+ ```
151
+
152
+ 如果分支存在,检出它:
153
+ ```bash
154
+ git checkout $(jq -r '.branchName' prd.json)
155
+ ```
156
+
157
+ ### Step 3: 初始化进度文件
158
+
159
+ 如果 `prd-progress.txt` 不存在,创建它:
160
+ ```bash
161
+ echo "# Ralph YOLO Progress Log" > prd-progress.txt
162
+ echo "Started: $(date)" >> prd-progress.txt
163
+ echo "---" >> prd-progress.txt
164
+ ```
165
+
166
+ ### Step 4: 顺序执行用户故事
167
+
168
+ **核心工作流程:**
169
+
170
+ 对于每个未完成的用户故事(`passes: false`),按 `priority` 升序:
171
+
172
+ 1. **选择故事**:找到最低 `priority` 且 `passes: false` 的故事
173
+ 2. **创建子 Agent**:使用 `Task` tool 创建合适的子 agent
174
+ 3. **等待完成**:同步等待子 agent 完成(不使用 `run_in_background`)
175
+ 4. **验证完成**:检查 git 提交、工作区状态、质量检查
176
+ 5. **更新状态**:设置 `prd.json` 中该故事 `passes: true`
177
+ 6. **记录进度**:追加到 `prd-progress.txt`
178
+ 7. **继续下一个**:重复直到所有故事完成
179
+
180
+ ### 子 Agent 提示词模板
181
+
182
+ ```
183
+ 你是一个独立的开发 agent,正在完成一个用户故事。
184
+
185
+ ## 用户故事
186
+
187
+ **ID**: {story.id}
188
+ **标题**: {story.title}
189
+ **描述**: {story.description}
190
+
191
+ ## 验收标准
192
+
193
+ {逐条列出 acceptanceCriteria}
194
+
195
+ ## 上下文信息
196
+
197
+ - 项目: {prd.project}
198
+ - 功能分支: {prd.branchName}
199
+ - 功能描述: {prd.description}
200
+
201
+ ## 你需要做的事情
202
+
203
+ 1. 阅读并理解该用户故事
204
+ 2. 阅读项目的现有代码,了解代码结构
205
+ 3. 实现该用户故事
206
+ 4. 运行质量检查(typecheck, lint, test 等)
207
+ 5. 如果检查通过,提交代码:
208
+ - 提交信息格式: `feat: {story.id} - {story.title}`
209
+ - 使用 Co-Authored-By: Claude <noreply@anthropic.com>
210
+ 6. 如果检查失败,修复问题直到通过
211
+ 7. 确保所有验收标准都满足
212
+
213
+ ## 重要约束
214
+
215
+ - 只工作于这一个用户故事
216
+ - 不要修改其他无关代码
217
+ - 遵循项目现有的代码模式和约定
218
+ - 提交前确保所有检查通过
219
+
220
+ 完成后,请明确报告:
221
+ - 实现了什么
222
+ - 修改了哪些文件
223
+ - 是否成功提交
224
+ - 遇到的任何问题或学习点
225
+ ```
226
+
227
+ ### Agent 类型选择
228
+
229
+ | 任务类型 | Agent 类型 | 说明 |
230
+ |---------|-----------|------|
231
+ | UI 设计需求 | `ui-ux-designer` | 设计界面和用户体验 |
232
+ | 一般开发 | `Full-stack-developer` | 日常全栈开发任务 |
233
+ | 复杂任务 | `general-purpose` | 多步骤复杂任务 |
234
+
235
+ ### 进度报告
236
+
237
+ 每个子 agent 完成后,向用户报告:
238
+
239
+ ```
240
+ ✓ 完成 US-001: Add priority field to database
241
+ - Agent: Full-stack-developer
242
+ - 提交: abc1234
243
+ - 文件: src/db/schema.sql, migrations/001_add_priority.sql
244
+
245
+ 进度: 1/4 (25%)
246
+ 剩余故事:
247
+ - US-002: Display priority indicator (priority: 2)
248
+ - US-003: Add priority selector (priority: 3)
249
+ - US-004: Filter by priority (priority: 4)
250
+
251
+ 正在启动下一个 agent...
252
+ ```
253
+
254
+ ### Step 5: 完成检测
255
+
256
+ 当所有用户故事的 `passes` 都为 `true` 时:
257
+
258
+ 1. 输出完成信号:
259
+ ```
260
+ <promise>COMPLETE</promise>
261
+ ```
262
+
263
+ 2. 显示完成摘要:
264
+ ```
265
+ ═══════════════════════════════════════════════════════
266
+ Ralph YOLO 完成所有任务!
267
+ ═══════════════════════════════════════════════════════
268
+ 总计完成: X 个用户故事
269
+ 进度文件: prd-progress.txt
270
+ Git 提交: git log --oneline
271
+ ```
272
+
273
+ 3. 退出循环
274
+
275
+ ---
276
+
277
+ ## 示例会话
278
+
279
+ ```
280
+ User: /ralph-yolo tasks/prd-task-priority.md
281
+
282
+ AI:
283
+ ✓ 正在转换 PRD 到 prd.json...
284
+ ✓ 已创建包含 4 个用户故事的 prd.json
285
+ ✓ 检查前置条件...
286
+ ✓ Git 工作区干净
287
+ ✓ 创建分支 ralph/task-priority...
288
+
289
+ ══════════════════════════════════════════════════════
290
+ Ralph YOLO - 自主 Agent 循环
291
+ ══════════════════════════════════════════════════════
292
+ 找到 4 个用户故事
293
+ 开始执行...
294
+
295
+ ────────────────────────────────────────────────────────────
296
+ [Agent 1/4] Full-stack-developer
297
+ 任务: US-001 - Add priority field to database
298
+ ────────────────────────────────────────────────────────────
299
+
300
+ [子 agent 执行中...]
301
+
302
+ ✓ 完成 US-001: Add priority field to database
303
+ - Agent: Full-stack-developer
304
+ - 提交: abc1234
305
+ - 文件: src/db/schema.sql, migrations/001_add_priority.sql
306
+
307
+ 进度: 1/4 (25%)
308
+ 正在启动下一个 agent...
309
+
310
+ [继续执行...]
311
+
312
+ ══════════════════════════════════════════════════════
313
+ Ralph YOLO 完成所有任务!══════════════════════════════════════════════════════
314
+ 总计完成: 4 个用户故事
315
+ 分支: ralph/task-priority
316
+
317
+ 查看详情:
318
+ cat prd-progress.txt
319
+ git log --oneline
320
+
321
+ <promise>COMPLETE</promise>
322
+ ```
323
+
324
+ ---
325
+
326
+ ## 关键文件
327
+
328
+ | 文件 | 用途 |
329
+ |------|------|
330
+ | `prd.json` | 用户故事及其 `passes` 状态 |
331
+ | `prd-progress.txt` | 追踪学习进度的追加日志 |
332
+ | `.claude/archive/` | 旧运行的存档 |
333
+
334
+ ---
335
+
336
+ ## 提示
337
+
338
+ 1. **保持故事小** - 每个必须在一个上下文窗口内完成
339
+ 2. **按依赖排序** - schema 在前,然后是后端,然后是 UI
340
+ 3. **可验证的标准** - "Typecheck passes" 而不是 "工作正常"
341
+ 4. **干净的 git 状态** - 从干净的工作区开始
342
+ 5. **监控进度** - 定期检查 `prd-progress.txt` 和 git log
343
+
344
+ ---
345
+
346
+ **准备好运行 Ralph YOLO。提供 PRD 路径进行转换,或者浮浮酱会使用现有的 prd.json** φ(≧ω≦*)♪
@@ -0,0 +1,226 @@
1
+ ---
2
+ description: Convert PRD to Ralph format and run the autonomous agent loop
3
+ ---
4
+
5
+ # Ralph - Autonomous Agent Loop
6
+
7
+ Ralph implements PRDs by repeatedly spawning fresh AI instances to complete user stories one by one.
8
+
9
+ ---
10
+
11
+ ## Phase 1: PRD Conversion (if markdown PRD provided)
12
+
13
+ ### Step 1: Check Input
14
+
15
+ Check if the user provided a path to a PRD file. If not, look for `prd.json` in the project root.
16
+
17
+ **User input formats:**
18
+ - `/ralph tasks/prd-my-feature.md` - Convert PRD and run Ralph
19
+ - `/ralph prd.json` - Run Ralph with existing prd.json
20
+ - `/ralph` - Run Ralph (looks for prd.json)
21
+
22
+ ### Step 2: Archive Previous Run (if needed)
23
+
24
+ Check if `prd.json` exists with a different `branchName`. If so:
25
+ 1. Read current `prd.json` and extract `branchName`
26
+ 2. Check if it differs from the new feature's branch
27
+ 3. If different AND `prd-progress.txt` has content:
28
+ - Create archive folder: `.claude/archive/YYYY-MM-DD-[feature-name]/`
29
+ - Copy current `prd.json` and `prd-progress.txt` to archive
30
+ - Reset `prd-progress.txt` with fresh header
31
+
32
+ ### Step 3: Convert to prd.json
33
+
34
+ Parse the PRD and generate `prd.json` in the project root:
35
+
36
+ ```json
37
+ {
38
+ "project": "[Project Name from PRD or auto-detected]",
39
+ "branchName": "ralph/[feature-name-kebab-case]",
40
+ "description": "[Feature description from PRD]",
41
+ "userStories": [
42
+ {
43
+ "id": "US-001",
44
+ "title": "[Story title]",
45
+ "description": "As a [user], I want [feature] so that [benefit]",
46
+ "acceptanceCriteria": [
47
+ "Criterion 1",
48
+ "Criterion 2",
49
+ "Typecheck passes"
50
+ ],
51
+ "priority": 1,
52
+ "passes": false,
53
+ "notes": ""
54
+ }
55
+ ]
56
+ }
57
+ ```
58
+
59
+ ### Conversion Rules
60
+
61
+ 1. **Each user story becomes one JSON entry**
62
+ 2. **IDs**: Sequential (US-001, US-002, etc.)
63
+ 3. **Priority**: Based on dependency order (schema → backend → UI)
64
+ 4. **All stories**: `passes: false` and empty `notes`
65
+ 5. **branchName**: Derive from feature name, kebab-case, prefixed with `ralph/`
66
+ 6. **Always add**: "Typecheck passes" to every story
67
+ 7. **For UI stories**: Add "Verify in browser using dev-browser skill"
68
+
69
+ ### Story Sizing is Critical
70
+
71
+ Each story MUST be completable in ONE Ralph iteration.
72
+
73
+ **Right-sized stories:**
74
+ - Add a database column and migration
75
+ - Add a UI component to an existing page
76
+ - Update a server action with new logic
77
+ - Add a filter dropdown to a list
78
+
79
+ **Too big (must split):**
80
+ - "Build the entire dashboard" → Split into: schema, queries, UI components, filters
81
+ - "Add authentication" → Split into: schema, middleware, login UI, session handling
82
+
83
+ **Rule of thumb:** If you cannot describe the change in 2-3 sentences, it is too big.
84
+
85
+ ### Story Ordering
86
+
87
+ Stories execute in `priority` order. Earlier stories must NOT depend on later ones.
88
+
89
+ **Correct order:**
90
+ 1. Schema/database changes (migrations)
91
+ 2. Server actions / backend logic
92
+ 3. UI components that use the backend
93
+ 4. Dashboard/summary views that aggregate data
94
+
95
+ ### Verification Before Proceeding
96
+
97
+ Before running Ralph, verify:
98
+ - [ ] Previous run archived (if applicable)
99
+ - [ ] Each story is completable in one iteration
100
+ - [ ] Stories are ordered by dependencies
101
+ - [ ] Every story has "Typecheck passes"
102
+ - [ ] UI stories have "Verify in browser using dev-browser skill"
103
+ - [ ] Acceptance criteria are verifiable (not vague)
104
+
105
+ ---
106
+
107
+ ## Phase 2: Ralph Execution
108
+
109
+ ### Step 1: Pre-flight Checks
110
+
111
+ Verify the following before starting:
112
+
113
+ **1. Amp CLI installed**
114
+ ```bash
115
+ which amp
116
+ ```
117
+ If not found, instruct user to install from https://ampcode.com
118
+
119
+ **2. jq installed**
120
+ ```bash
121
+ which jq
122
+ ```
123
+ If not found, instruct user to install (brew install jq on macOS)
124
+
125
+ **3. Git working directory clean**
126
+ ```bash
127
+ git status --porcelain
128
+ ```
129
+ If not clean, ask user to commit or stash changes
130
+
131
+ **4. prd.json exists and is valid**
132
+ ```bash
133
+ cat prd.json | jq .
134
+ ```
135
+ If invalid, show error and exit
136
+
137
+ ### Step 2: Create or Checkout Feature Branch
138
+
139
+ Read `branchName` from `prd.json`:
140
+ ```bash
141
+ jq -r '.branchName' prd.json
142
+ ```
143
+
144
+ If branch doesn't exist, create it from main:
145
+ ```bash
146
+ git checkout -b $(jq -r '.branchName' prd.json)
147
+ ```
148
+
149
+ If branch exists, checkout it:
150
+ ```bash
151
+ git checkout $(jq -r '.branchName' prd.json)
152
+ ```
153
+
154
+ ### Step 3: Run Ralph Loop
155
+
156
+ Execute the Ralph script:
157
+ ```bash
158
+ bash .claude/scripts/ralph.sh [max_iterations]
159
+ ```
160
+
161
+ Default is 10 iterations. The script will:
162
+
163
+ 1. Spawn a fresh Amp instance with `.claude/scripts/prompt.md`
164
+ 2. Amp picks the highest priority story with `passes: false`
165
+ 3. Amp implements that single story
166
+ 4. Amp runs quality checks (typecheck, lint, test)
167
+ 5. If checks pass, Amp commits with message: `feat: [Story ID] - [Story Title]`
168
+ 6. Amp updates `prd.json` to set `passes: true` for the story
169
+ 7. Amp appends progress to `prd-progress.txt`
170
+ 8. Loop repeats until all stories pass or max iterations reached
171
+
172
+ ### Step 4: Monitor Progress
173
+
174
+ Show the user how to monitor:
175
+ ```bash
176
+ # See which stories are done
177
+ cat prd.json | jq '.userStories[] | {id, title, passes}'
178
+
179
+ # See learnings from previous iterations
180
+ cat prd-progress.txt
181
+
182
+ # Check git history
183
+ git log --oneline -10
184
+ ```
185
+
186
+ ### Step 5: Completion
187
+
188
+ When ALL stories have `passes: true`, Ralph will output:
189
+ ```
190
+ <promise>COMPLETE</promise>
191
+ ```
192
+
193
+ And the loop exits successfully.
194
+
195
+ ---
196
+
197
+ ## Example Session
198
+
199
+ ```
200
+ User: /ralph tasks/prd-task-priority.md
201
+
202
+ AI:
203
+ - Converting PRD to prd.json...
204
+ - Created prd.json with 4 user stories
205
+ - Checking prerequisites...
206
+ ✓ Amp CLI installed
207
+ ✓ jq installed
208
+ ✓ Git working directory clean
209
+ - Creating branch ralph/task-priority...
210
+ - Starting Ralph loop...
211
+
212
+ [Ralph executes iterations...]
213
+
214
+ Iteration 1: US-001 - Add priority field to database ✓
215
+ Iteration 2: US-002 - Display priority indicator on task cards ✓
216
+ Iteration 3: US-003 - Add priority selector to task edit ✓
217
+ Iteration 4: US-004 - Filter tasks by priority ✓
218
+
219
+ <promise>COMPLETE</promise>
220
+
221
+ All stories completed! Check prd-progress.txt for details.
222
+ ```
223
+
224
+ ---
225
+
226
+ **Ready to run Ralph. Provide a PRD path to convert, or I'll use existing prd.json.**
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: 全栈安全审计 — 静态+动态+依赖CVE,证据驱动分级报告,只审计不修复
3
+ ---
4
+
5
+ # /security-audit
6
+
7
+ 读取 `.claude/skills/security-audit/SKILL.md` 并对 `$ARGUMENTS` 指定的仓库做全栈安全审计。先 codebase 知识图谱嵌入,再按技术栈分面静态审计 + 依赖 CVE 比对,然后公网/内网动态渗透,最后在 `.debug/` 输出证据驱动、分级清晰的报告。只审计不修复,不产生 commit/push。
@@ -0,0 +1,133 @@
1
+ ---
2
+ description: UX Experience Audit - 从用户旅程出发的跨层体验审计与修复闭环
3
+ ---
4
+
5
+ # /ux-experience-audit - 用户体验审计
6
+
7
+ 你现在激活了 **UX Experience Audit(用户体验审计)** 流程,专门处理“功能看似完成但体验不通”的问题。
8
+
9
+ > 建议先阅读 skill `ux-experience-audit` 获取完整方法论。
10
+
11
+ ---
12
+
13
+ ## 适用场景
14
+
15
+ - 配置改了没反应、按钮点了没反馈、状态不清楚
16
+ - 模型/供应商切换失败,但错误信息不清晰
17
+ - 复制/导出等关键操作经常报错或静默失败
18
+ - 用户能勉强完成任务,但觉得“很难用/不可信”
19
+
20
+ 不适合:
21
+
22
+ - 纯代码级 Bug 修复(建议先 `/debug`)
23
+ - 纯视觉/UI 美化(建议用 `/debug-ui`)
24
+
25
+ ---
26
+
27
+ ## 标准工作流程(结合本脚手架)
28
+
29
+ ### 1. 构建用户旅程地图
30
+
31
+ 引导用户用句式重述问题:
32
+
33
+ ```text
34
+ 用户在 <步骤> 做 <动作> 后,预期 <结果>,实际 <结果>
35
+ ```
36
+
37
+ 并标出:
38
+
39
+ - 所在页面或模块(例如:web 前端页面、ui 包组件、配置面板等)
40
+ - 操作路径:从进入页面到出问题的完整步骤
41
+ - 每一步的可见信号:按钮/Toast/加载/错误提示/网络请求
42
+
43
+ ### 2. 运行 UX 命令审计(依赖 Codex skill 脚本)
44
+
45
+ 本脚手架已经引入了 Codex 版 `ux-experience-audit` 脚本,可以直接在项目根目录执行:
46
+
47
+ ```powershell
48
+ powershell -ExecutionPolicy Bypass -File .codex/skills/ux-experience-audit/scripts/ux-audit.ps1 -Mode scan -ProjectRoot .
49
+ ```
50
+
51
+ 或按需引导执行核心扫描命令:
52
+
53
+ ```powershell
54
+ rg -n "provider|baseURL|model|apiKey|loadModels|testConnection|chatStream|handleCopy|useMessage" packages
55
+ rg -n "@click|@copy|@send|message\.success|message\.error|warning\(" packages/web/src packages/ui/src
56
+ rg -n "TODO|FIXME|HACK|XXX" packages docs
57
+ ```
58
+
59
+ 你的任务:
60
+
61
+ - 结合扫描结果,按模块聚合潜在 UX 断点
62
+ - 标记典型问题:配置不生效、交互无反馈、错误静默/误导、链路断裂等
63
+
64
+ ### 3. 按 UX 影响度排序
65
+
66
+ 使用统一优先级:
67
+
68
+ - `P0`:阻断主流程(无法配置/无法发送/数据丢失/核心按钮崩溃)
69
+ - `P1`:高摩擦(可绕过但频繁失败、错误提示不清、结果不可信)
70
+ - `P2`:体验优化(文案/默认值/交互一致性/辅助反馈)
71
+
72
+ 在同一模块内,**先清零 P0,再处理 P1/P2**。
73
+
74
+ ### 4. 设计最小跨层修复
75
+
76
+ - 以“用户可感知路径”为边界,而不是前端/后端/配置的团队边界
77
+ - 每次只修一条体验链路(例如:从“点击发送”到“看到结果/错误”的链路)
78
+ - 典型改动:
79
+ - 文案改进,说明当前状态和下一步操作
80
+ - 补充 Loading/Disabled/重试逻辑
81
+ - 修正前后端字段或状态不一致导致的“成功无反馈/错误静默”
82
+ - 配置默认值、空值保护、回退策略
83
+
84
+ ### 5. 执行 Checkfix 闭环
85
+
86
+ 在有改动的前后端模块上执行至少一类自动检查(build/lint/test 任一);推荐直接使用脚本的 `full` 模式:
87
+
88
+ ```powershell
89
+ powershell -ExecutionPolicy Bypass -File .codex/skills/ux-experience-audit/scripts/ux-audit.ps1 -Mode full -ProjectRoot .
90
+ ```
91
+
92
+ - 检查通过:记录命令与结果,作为本轮体验修复的验证依据
93
+ - 检查失败:当轮尽量给出修复建议,无法立即解决的记为技术债并标明优先级
94
+
95
+ ### 6. 同步 .debug 与 docs
96
+
97
+ - `.debug/<module>-debug.md`:
98
+ - 补充:问题、根因、改动、验证步骤与结果、影响评估
99
+ - `docs/`:
100
+ - 若前端体验可见变化:为零基础用户补充操作步骤、常见问题与回滚方式
101
+ - 若涉及配置/API/环境:更新相关部署/配置文档
102
+
103
+ ---
104
+
105
+ ## 输出格式(强约束)
106
+
107
+ 完成 `/ux-experience-audit` 后,输出内容应遵循:
108
+
109
+ ```markdown
110
+ ## 用户问题重述
111
+ ## 体验断点地图
112
+ ## 根因与优先级(P0/P1/P2)
113
+ ## 修复与改动文件
114
+ ## 验证命令与结果
115
+ ## 文档与.debug更新
116
+ ## 残留风险与下一步
117
+ ```
118
+
119
+ ---
120
+
121
+ ## 用户输入
122
+
123
+ 请按下面格式描述你现在遇到的体验问题(可以粗略写,我会帮你结构化):
124
+
125
+ ```markdown
126
+ ## 当前场景
127
+
128
+ ## 体验问题
129
+ 用户在 <步骤> 做 <动作> 后,预期 <结果>,实际 <结果>
130
+
131
+ ## 涉及模块/页面
132
+ ```
133
+