♻️ refactor: 需求与计划改走 ECC 工作流,PRD/计划落到 .claude 目录
头脑风暴、续聊、实施三套 prompt(vscode / jetbrains / tui 同步)从 superpowers 的 brainstorming 与 /goal 换成 /ecc:plan-prd、/ecc:plan、/ecc:tdd-workflow。spec/plan 路径固定为 .claude/prds/<slug>.prd.md 与 .claude/plans/<slug>.plan.md,slug 派生去掉 .prd.md / .plan.md 后缀;worktreePath 测试挪到 test/ 目录。 Claude-Session: https://claude.ai/code/session_01QWxLb6X8Vd2G5vHnp6R7qm
This commit is contained in:
1 parent
028195ab2b
commit
1fee0f2630
19 files changed
+136
-90
No files matched your search
@@ -21,9 +21,9 @@ data class Issue(
|
||||
val profilePath: String? = null,
|
||||
/** 测试会话专用的 Claude 配置文件,独立于实施会话的 profilePath;留空回退到 profilePath 再回退默认。 */
|
||||
val testProfilePath: String? = null,
|
||||
/** spec 文档路径,相对 workspace,位于 docs/superpowers/specs 下的 .md 文件。 */
|
||||
/** spec 文档路径,相对 workspace,即 ECC 的 PRD(.claude/prds/<slug>.prd.md)。 */
|
||||
val specFile: String? = null,
|
||||
/** plan 文档路径,相对 workspace,位于 docs/superpowers/plans 下的 .md 文件。 */
|
||||
/** plan 文档路径,相对 workspace,即 ECC 的实施计划(.claude/plans/<slug>.plan.md)。 */
|
||||
val planFile: String? = null,
|
||||
/** PR 变更摘要文件路径,相对 workspace。 */
|
||||
val prDiffFile: String? = null,
|
||||
|
||||
@@ -22,15 +22,16 @@ object DefaultPrompts {
|
||||
}
|
||||
|
||||
private const val FALLBACK_BRAINSTORM =
|
||||
"/goal 我现在有这样一个需求 {userRequest},你用 spx 命令创建 gitea 工单。" +
|
||||
"我现在有这样一个需求 {userRequest},你用 spx 命令创建 gitea 工单。" +
|
||||
"工单 body 末尾必须包含 <!-- spx:nonce={nonce} -->。创建完工单立即停下汇报,不要擅自实施。"
|
||||
|
||||
private const val FALLBACK_BRAINSTORM_CONTINUE =
|
||||
"/superpowers:brainstorming 讨论下 {issueNumber} 号工单。注意:不要 git checkout / 不要写代码 / 不要建 PR," +
|
||||
"只讨论需求与 spec/plan,用 spx issue marker 更新 marker。"
|
||||
"/ecc:plan-prd 讨论下 {issueNumber} 号工单。PRD 写到 .claude/prds/<slug>.prd.md," +
|
||||
"我确认后用 ecc:plan 出 .claude/plans/<slug>.plan.md,两个文件在 main 上提交并用 spx issue marker 同步 marker。" +
|
||||
"不要 git checkout / 不要写代码 / 不要建 PR。"
|
||||
|
||||
private const val FALLBACK_IMPLEMENT_PLAN =
|
||||
"/goal 使用子代理全程绿灯实施 @{planFile},发起 PR 时在 body 中包含 \"Closes #{issueNumber}\"。严禁合并 PR。"
|
||||
"/ecc:tdd-workflow @{planFile} 按计划实施,编码派子代理,发起 PR 时在 body 中包含 \"Closes #{issueNumber}\"。严禁合并 PR。"
|
||||
|
||||
private const val FALLBACK_REVIEW =
|
||||
"/review 用 tea 拿到 #{prNumber} PR 审查。审查意见用 spx pr review-comment 发评论," +
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
/superpowers:brainstorming 讨论下 {issueNumber} 号工单
|
||||
/ecc:plan-prd 讨论下 {issueNumber} 号工单
|
||||
|
||||
用tea命令找工单
|
||||
用 tea 命令找工单,用 grill-me skill 讨论细节,用表单形式和我交互,每次只问一个问题(`/ecc:plan-prd` 里成组的问题也拆成一次一问)。
|
||||
|
||||
## 后续 marker 维护(本会话有效)
|
||||
## 产物与顺序
|
||||
|
||||
spec/plan 文件**一律在当前主 worktree(main 分支)创建**,不要为此新建或切换分支。创建后追加对应 marker:
|
||||
1. 需求讨论清楚后,按 `/ecc:plan-prd` 的模板写 PRD 到 `.claude/prds/<slug>.prd.md`,让我确认。
|
||||
2. PRD 我确认后,用 Skill 工具调 `ecc:plan`,参数是 PRD 路径,产出 `.claude/plans/<slug>.plan.md`;计划出来后停下等我确认。
|
||||
3. `<slug>` 取工单标题的英文短横线名,PRD 与计划共用;工单已有 marker 就沿用其中的 slug。
|
||||
|
||||
## marker 维护(本会话有效)
|
||||
|
||||
PRD / 计划文件**一律在当前主 worktree(main 分支)创建并提交**,每次只提交这两个文件(提交信息形如 `📝 docs: #<工单号> 需求文档` / `📝 docs: #<工单号> 实施计划`),不要为此新建或切换分支。创建后追加对应 marker:
|
||||
|
||||
```
|
||||
opencli spx issue marker --issue <工单号> --type spec --value <spec 路径>
|
||||
opencli spx issue marker --issue <工单号> --type plan --value <plan 路径>
|
||||
opencli spx issue marker --issue <工单号> --type spec --value .claude/prds/<slug>.prd.md
|
||||
opencli spx issue marker --issue <工单号> --type plan --value .claude/plans/<slug>.plan.md
|
||||
```
|
||||
|
||||
## 严禁擅自继续
|
||||
|
||||
如果你创建/更新了 spec/plan 文件并 marker 已同步,**立即停下**汇报;不要进入实施流程。
|
||||
如果你创建/更新了 PRD 或计划文件并 marker 已同步,**立即停下**汇报;不要进入实施流程。
|
||||
|
||||
特别地:
|
||||
|
||||
- 不要创建分支
|
||||
- 不要切换分支,包括 `git checkout` / `git switch`
|
||||
- 不要修改当前主 worktree 所在分支
|
||||
- spec/plan 一律在 main 分支(当前主 worktree)创建
|
||||
- 不要修改任何代码文件
|
||||
- 除 PRD / 计划文件外不要修改任何文件
|
||||
- 不要创建 PR
|
||||
- 不要调用 gitea 其他写操作(除上面的 marker 同步)
|
||||
|
||||
只讨论需求与 spec/plan,必要时用 spx issue marker 更新 marker。
|
||||
@@ -25,13 +25,20 @@ opencli spx issue create --title "<标题>" --body-file /tmp/issue-body.md
|
||||
|
||||
spx 返回工单号 + html_url。记下工单号,后续命令用。
|
||||
|
||||
## 后续 marker 维护(本会话有效)
|
||||
## 后续需求文档 / 计划维护(本会话有效)
|
||||
|
||||
**只有**当你真正创建了 spec 或 plan 文件后才追加对应 marker。路径形如 `docs/superpowers/specs/<slug>/spec.md` 或 `docs/superpowers/plans/<slug>/plan.md`。spec/plan 文件**一律在当前主 worktree(main 分支)创建**,不要为此新建或切换分支:
|
||||
需求与计划走 ECC 工作流:`/ecc:plan-prd` 产出需求文档(PRD),`/ecc:plan <PRD 路径>` 产出实施计划。文件路径固定:
|
||||
|
||||
- PRD:`.claude/prds/<slug>.prd.md`
|
||||
- 计划:`.claude/plans/<slug>.plan.md`
|
||||
|
||||
`<slug>` 取工单标题的英文短横线名(如 `app-entity`),PRD 与计划用同一个 slug。两个文件**一律在当前主 worktree(main 分支)创建并提交**,每次只提交这两个文件(提交信息形如 `📝 docs: #<工单号> 需求文档` / `📝 docs: #<工单号> 实施计划`);实施 worktree 从 main 当前提交切出,没提交的文件在那边看不到。
|
||||
|
||||
**只有**当你真正创建了 PRD 或计划文件后才追加对应 marker:
|
||||
|
||||
```
|
||||
opencli spx issue marker --issue <工单号> --type spec --value <spec 路径>
|
||||
opencli spx issue marker --issue <工单号> --type plan --value <plan 路径>
|
||||
opencli spx issue marker --issue <工单号> --type spec --value .claude/prds/<slug>.prd.md
|
||||
opencli spx issue marker --issue <工单号> --type plan --value .claude/plans/<slug>.plan.md
|
||||
```
|
||||
|
||||
spx 自动找到对应行替换或追加,保留所有其他 marker。**不要自己手写 `<!-- spx:* -->` 行**。
|
||||
@@ -44,5 +51,4 @@ spx 自动找到对应行替换或追加,保留所有其他 marker。**不要
|
||||
|
||||
- 不要创建分支
|
||||
- 不要切换分支
|
||||
- 不要修改当前主 worktree 所在分支
|
||||
- spec/plan 一律在 main 分支(当前主 worktree)创建
|
||||
- 除 PRD / 计划文件外不要改动或提交任何文件
|
||||
@@ -1,4 +1,6 @@
|
||||
/goal 使用子代理全程绿灯实施 @{planFile},发起 PR 时务必在 PR body 中包含 "Closes #{issueNumber}"。
|
||||
/ecc:tdd-workflow @{planFile}
|
||||
|
||||
按计划实施 {issueNumber} 号工单:具体编码派子代理去做,全程保持测试绿灯。计划里的验证命令只当意图,落地时用仓库自己的 test / lint / typecheck 命令。提 PR 前先 `/ecc:code-review` 自审并修掉严重问题。发起 PR 时务必在 PR body 中包含 "Closes #{issueNumber}"。
|
||||
|
||||
**严禁合并 PR**:你的职责只到发起 PR 为止,后续审查反馈到了请继续修复并 push,永远不要执行 `tea pulls merge` 或任何合并操作。
|
||||
|
||||
@@ -10,4 +12,4 @@
|
||||
- 生成后立即 `git add` 提交迁移文件,纳入 PR。
|
||||
- **绝不**对共享 dev DB(`192.168.1.4:5433`)或 prod 执行 `alembic upgrade` / `downgrade` 等任何改库命令。
|
||||
- 需要运行时验证迁移,就起一个一次性独立库(本地 docker postgres 或唯一命名的 scratch 库),在它上面 upgrade,验证完即丢弃,不要留痕。
|
||||
- 共享 dev DB 与 prod 的迁移合并后由用户统一执行,时机由用户决定。
|
||||
- 共享 dev DB 与 prod 的迁移合并后由用户统一执行,时机由用户决定。
|
||||
@@ -1,28 +1,30 @@
|
||||
/superpowers:brainstorming 讨论下 {issueNumber} 号工单
|
||||
/ecc:plan-prd 讨论下 {issueNumber} 号工单
|
||||
|
||||
用tea命令找工单
|
||||
用 tea 命令找工单,用 grill-me skill 讨论细节,用表单形式和我交互,每次只问一个问题(`/ecc:plan-prd` 里成组的问题也拆成一次一问)。
|
||||
|
||||
## 后续 marker 维护(本会话有效)
|
||||
## 产物与顺序
|
||||
|
||||
spec/plan 文件**一律在当前主 worktree(main 分支)创建**,不要为此新建或切换分支。创建后追加对应 marker:
|
||||
1. 需求讨论清楚后,按 `/ecc:plan-prd` 的模板写 PRD 到 `.claude/prds/<slug>.prd.md`,让我确认。
|
||||
2. PRD 我确认后,用 Skill 工具调 `ecc:plan`,参数是 PRD 路径,产出 `.claude/plans/<slug>.plan.md`;计划出来后停下等我确认。
|
||||
3. `<slug>` 取工单标题的英文短横线名,PRD 与计划共用;工单已有 marker 就沿用其中的 slug。
|
||||
|
||||
## marker 维护(本会话有效)
|
||||
|
||||
PRD / 计划文件**一律在当前主 worktree(main 分支)创建并提交**,每次只提交这两个文件(提交信息形如 `📝 docs: #<工单号> 需求文档` / `📝 docs: #<工单号> 实施计划`),不要为此新建或切换分支。创建后追加对应 marker:
|
||||
|
||||
```
|
||||
opencli spx issue marker --issue <工单号> --type spec --value <spec 路径>
|
||||
opencli spx issue marker --issue <工单号> --type plan --value <plan 路径>
|
||||
opencli spx issue marker --issue <工单号> --type spec --value .claude/prds/<slug>.prd.md
|
||||
opencli spx issue marker --issue <工单号> --type plan --value .claude/plans/<slug>.plan.md
|
||||
```
|
||||
|
||||
## 严禁擅自继续
|
||||
|
||||
如果你创建/更新了 spec/plan 文件并 marker 已同步,**立即停下**汇报;不要进入实施流程。
|
||||
如果你创建/更新了 PRD 或计划文件并 marker 已同步,**立即停下**汇报;不要进入实施流程。
|
||||
|
||||
特别地:
|
||||
|
||||
- 不要创建分支
|
||||
- 不要切换分支,包括 `git checkout` / `git switch`
|
||||
- 不要修改当前主 worktree 所在分支
|
||||
- spec/plan 一律在 main 分支(当前主 worktree)创建
|
||||
- 不要修改任何代码文件
|
||||
- 除 PRD / 计划文件外不要修改任何文件
|
||||
- 不要创建 PR
|
||||
- 不要调用 gitea 其他写操作(除上面的 marker 同步)
|
||||
|
||||
只讨论需求与 spec/plan,必要时用 spx issue marker 更新 marker。
|
||||
@@ -25,13 +25,20 @@ opencli spx issue create --title "<标题>" --body-file /tmp/issue-body.md
|
||||
|
||||
spx 返回工单号 + html_url。记下工单号,后续命令用。
|
||||
|
||||
## 后续 marker 维护(本会话有效)
|
||||
## 后续需求文档 / 计划维护(本会话有效)
|
||||
|
||||
**只有**当你真正创建了 spec 或 plan 文件后才追加对应 marker。路径形如 `docs/superpowers/specs/<slug>/spec.md` 或 `docs/superpowers/plans/<slug>/plan.md`。spec/plan 文件**一律在当前主 worktree(main 分支)创建**,不要为此新建或切换分支:
|
||||
需求与计划走 ECC 工作流:`/ecc:plan-prd` 产出需求文档(PRD),`/ecc:plan <PRD 路径>` 产出实施计划。文件路径固定:
|
||||
|
||||
- PRD:`.claude/prds/<slug>.prd.md`
|
||||
- 计划:`.claude/plans/<slug>.plan.md`
|
||||
|
||||
`<slug>` 取工单标题的英文短横线名(如 `app-entity`),PRD 与计划用同一个 slug。两个文件**一律在当前主 worktree(main 分支)创建并提交**,每次只提交这两个文件(提交信息形如 `📝 docs: #<工单号> 需求文档` / `📝 docs: #<工单号> 实施计划`);实施 worktree 从 main 当前提交切出,没提交的文件在那边看不到。
|
||||
|
||||
**只有**当你真正创建了 PRD 或计划文件后才追加对应 marker:
|
||||
|
||||
```
|
||||
opencli spx issue marker --issue <工单号> --type spec --value <spec 路径>
|
||||
opencli spx issue marker --issue <工单号> --type plan --value <plan 路径>
|
||||
opencli spx issue marker --issue <工单号> --type spec --value .claude/prds/<slug>.prd.md
|
||||
opencli spx issue marker --issue <工单号> --type plan --value .claude/plans/<slug>.plan.md
|
||||
```
|
||||
|
||||
spx 自动找到对应行替换或追加,保留所有其他 marker。**不要自己手写 `<!-- spx:* -->` 行**。
|
||||
@@ -44,5 +51,4 @@ spx 自动找到对应行替换或追加,保留所有其他 marker。**不要
|
||||
|
||||
- 不要创建分支
|
||||
- 不要切换分支
|
||||
- 不要修改当前主 worktree 所在分支
|
||||
- spec/plan 一律在 main 分支(当前主 worktree)创建
|
||||
- 除 PRD / 计划文件外不要改动或提交任何文件
|
||||
@@ -1,4 +1,6 @@
|
||||
/goal 使用子代理全程绿灯实施 @{planFile},发起 PR 时务必在 PR body 中包含 "Closes #{issueNumber}"。
|
||||
/ecc:tdd-workflow @{planFile}
|
||||
|
||||
按计划实施 {issueNumber} 号工单:具体编码派子代理去做,全程保持测试绿灯。计划里的验证命令只当意图,落地时用仓库自己的 test / lint / typecheck 命令。提 PR 前先 `/ecc:code-review` 自审并修掉严重问题。发起 PR 时务必在 PR body 中包含 "Closes #{issueNumber}"。
|
||||
|
||||
**严禁合并 PR**:你的职责只到发起 PR 为止,后续审查反馈到了请继续修复并 push,永远不要执行 `tea pulls merge` 或任何合并操作。
|
||||
|
||||
@@ -10,4 +12,4 @@
|
||||
- 生成后立即 `git add` 提交迁移文件,纳入 PR。
|
||||
- **绝不**对共享 dev DB(`192.168.1.4:5433`)或 prod 执行 `alembic upgrade` / `downgrade` 等任何改库命令。
|
||||
- 需要运行时验证迁移,就起一个一次性独立库(本地 docker postgres 或唯一命名的 scratch 库),在它上面 upgrade,验证完即丢弃,不要留痕。
|
||||
- 共享 dev DB 与 prod 的迁移合并后由用户统一执行,时机由用户决定。
|
||||
- 共享 dev DB 与 prod 的迁移合并后由用户统一执行,时机由用户决定。
|
||||
+6
-5
@@ -17,8 +17,8 @@
|
||||
+ feature 分支 测试会话可随时开
|
||||
```
|
||||
|
||||
1. **新建工单**:待办列头的 `+` → 写需求(可粘贴截图)→ 开一个 `claude` 头脑风暴会话,它用 `spx issue create` 建工单并回填 spec / plan 路径。
|
||||
2. **实施**:把卡拖到「进行中」(或点计划文件行的 ▶)。插件创建 `feature/<slug>` 分支 + git worktree,在里面开 `issue-N-实施` 终端并发实施 prompt;实施方在 PR body 里写 `Closes #N`。
|
||||
1. **新建工单**:待办列头的 `+` → 写需求(可粘贴截图)→ 开一个 `claude` 头脑风暴会话,它用 `spx issue create` 建工单,再经 `/ecc:plan-prd` + `/ecc:plan` 写出 PRD / 计划并回填两者路径。
|
||||
2. **实施**:把卡拖到「进行中」(或点计划文件行的 ▶)。插件创建 `feature/<slug>` 分支 + git worktree,在里面开 `issue-N-实施` 终端并发实施 prompt,实施方对计划跑 `/ecc:tdd-workflow`,在 PR body 里写 `Closes #N`。
|
||||
3. **审查**:PR opened / synchronize 的 webhook 到达后,插件自动开 `issue-N-审查`(codex);审查意见通过 `spx pr review-comment` 发到 PR,webhook 再把意见注入实施终端形成闭环。
|
||||
4. **测试**:工单面板里 ▶ 开 `issue-N-测试` 会话(`/pr-acceptance-testing`)。
|
||||
5. **完成**:拖到「完成」列。有 PR 就由插件合并(冲突时开 `issue-N-冲突解决` 会话,解决后再拖一次),然后关工单、把会话记录拷回主仓库、删 worktree、删 feature 分支。
|
||||
@@ -41,6 +41,7 @@
|
||||
|---|---|
|
||||
| `git` | worktree、分支、fetch / merge |
|
||||
| `claude` | 规划、实施、测试、冲突解决、提交、PR 摘要(找不到时会提示常见位置 `~/.local/bin`) |
|
||||
| ECC 插件(`ecc@ecc`) | Claude Code 插件,头脑风暴 / 实施会话用它的 `/ecc:plan-prd` `/ecc:plan` `/ecc:tdd-workflow` `/ecc:code-review` |
|
||||
| `codex` | 审查会话(开启自动审查时必需) |
|
||||
| `tea` | `spx` 从 `~/.config/tea/config.yml` 读取 Gitea host + token;审查 prompt 也用 `tea pulls` 看 PR |
|
||||
| `spx` | 本仓库 `cli/` 里的 Go CLI,见下文 |
|
||||
@@ -171,8 +172,8 @@ prompts 在 `prompts/*.md`,随 VSIX 一起安装,改完即生效,也可在
|
||||
## 工作区约定
|
||||
|
||||
```
|
||||
docs/superpowers/specs/<slug>/spec.md
|
||||
docs/superpowers/plans/<slug>/plan.md
|
||||
.claude/prds/<slug>.prd.md # PRD,即工单的 spec marker
|
||||
.claude/plans/<slug>.plan.md # 实施计划,即 plan marker
|
||||
docs/pr-diff/pr-<pr>-issue-<n>.md # PR 变更摘要
|
||||
.spx/profiles.json # Profile tab
|
||||
.spx/session-names.json # 会话 tab
|
||||
@@ -183,7 +184,7 @@ docs/pr-diff/pr-<pr>-issue-<n>.md # PR 变更摘要
|
||||
.spx/*.sh # 钩子脚本
|
||||
```
|
||||
|
||||
实施分支名 `feature/<slug>`,slug 取 plan 路径里 `plans/` 后的一段。
|
||||
实施分支名 `feature/<slug>`,slug 取 plan 路径里 `plans/` 后的一段(去掉 `.plan.md`)。
|
||||
|
||||
## 开发
|
||||
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
/superpowers:brainstorming 讨论下 {issueNumber} 号工单
|
||||
/ecc:plan-prd 讨论下 {issueNumber} 号工单
|
||||
|
||||
用tea命令找工单,用grill-me skill讨论细节,用表单形式和我交互,每次只问一个问题
|
||||
用 tea 命令找工单,用 grill-me skill 讨论细节,用表单形式和我交互,每次只问一个问题(`/ecc:plan-prd` 里成组的问题也拆成一次一问)。
|
||||
|
||||
## 后续 marker 维护(本会话有效)
|
||||
## 产物与顺序
|
||||
|
||||
spec/plan 文件**一律在当前主 worktree(main 分支)创建**,不要为此新建或切换分支。创建后追加对应 marker:
|
||||
1. 需求讨论清楚后,按 `/ecc:plan-prd` 的模板写 PRD 到 `.claude/prds/<slug>.prd.md`,让我确认。
|
||||
2. PRD 我确认后,用 Skill 工具调 `ecc:plan`,参数是 PRD 路径,产出 `.claude/plans/<slug>.plan.md`;计划出来后停下等我确认。
|
||||
3. `<slug>` 取工单标题的英文短横线名,PRD 与计划共用;工单已有 marker 就沿用其中的 slug。
|
||||
|
||||
## marker 维护(本会话有效)
|
||||
|
||||
PRD / 计划文件**一律在当前主 worktree(main 分支)创建并提交**,每次只提交这两个文件(提交信息形如 `📝 docs: #<工单号> 需求文档` / `📝 docs: #<工单号> 实施计划`),不要为此新建或切换分支。创建后追加对应 marker:
|
||||
|
||||
```
|
||||
opencli spx issue marker --issue <工单号> --type spec --value <spec 路径>
|
||||
opencli spx issue marker --issue <工单号> --type plan --value <plan 路径>
|
||||
opencli spx issue marker --issue <工单号> --type spec --value .claude/prds/<slug>.prd.md
|
||||
opencli spx issue marker --issue <工单号> --type plan --value .claude/plans/<slug>.plan.md
|
||||
```
|
||||
|
||||
## 严禁擅自继续
|
||||
|
||||
如果你创建/更新了 spec/plan 文件并 marker 已同步,**立即停下**汇报;不要进入实施流程。
|
||||
如果你创建/更新了 PRD 或计划文件并 marker 已同步,**立即停下**汇报;不要进入实施流程。
|
||||
|
||||
特别地:
|
||||
|
||||
- 不要创建分支
|
||||
- 不要切换分支,包括 `git checkout` / `git switch`
|
||||
- 不要修改当前主 worktree 所在分支
|
||||
- spec/plan 一律在 main 分支(当前主 worktree)创建
|
||||
- 不要修改任何代码文件
|
||||
- 除 PRD / 计划文件外不要修改任何文件
|
||||
- 不要创建 PR
|
||||
- 不要调用 gitea 其他写操作(除上面的 marker 同步)
|
||||
|
||||
只讨论需求与 spec/plan,必要时用 spx issue marker 更新 marker。
|
||||
@@ -25,13 +25,20 @@ opencli spx issue create --title "<标题>" --body-file /tmp/issue-body.md
|
||||
|
||||
spx 返回工单号 + html_url。记下工单号,后续命令用。
|
||||
|
||||
## 后续 marker 维护(本会话有效)
|
||||
## 后续需求文档 / 计划维护(本会话有效)
|
||||
|
||||
**只有**当你真正创建了 spec 或 plan 文件后才追加对应 marker。路径形如 `docs/superpowers/specs/<slug>/spec.md` 或 `docs/superpowers/plans/<slug>/plan.md`。spec/plan 文件**一律在当前主 worktree(main 分支)创建**,不要为此新建或切换分支:
|
||||
需求与计划走 ECC 工作流:`/ecc:plan-prd` 产出需求文档(PRD),`/ecc:plan <PRD 路径>` 产出实施计划。文件路径固定:
|
||||
|
||||
- PRD:`.claude/prds/<slug>.prd.md`
|
||||
- 计划:`.claude/plans/<slug>.plan.md`
|
||||
|
||||
`<slug>` 取工单标题的英文短横线名(如 `app-entity`),PRD 与计划用同一个 slug。两个文件**一律在当前主 worktree(main 分支)创建并提交**,每次只提交这两个文件(提交信息形如 `📝 docs: #<工单号> 需求文档` / `📝 docs: #<工单号> 实施计划`);实施 worktree 从 main 当前提交切出,没提交的文件在那边看不到。
|
||||
|
||||
**只有**当你真正创建了 PRD 或计划文件后才追加对应 marker:
|
||||
|
||||
```
|
||||
opencli spx issue marker --issue <工单号> --type spec --value <spec 路径>
|
||||
opencli spx issue marker --issue <工单号> --type plan --value <plan 路径>
|
||||
opencli spx issue marker --issue <工单号> --type spec --value .claude/prds/<slug>.prd.md
|
||||
opencli spx issue marker --issue <工单号> --type plan --value .claude/plans/<slug>.plan.md
|
||||
```
|
||||
|
||||
spx 自动找到对应行替换或追加,保留所有其他 marker。**不要自己手写 `<!-- spx:* -->` 行**。
|
||||
@@ -44,5 +51,4 @@ spx 自动找到对应行替换或追加,保留所有其他 marker。**不要
|
||||
|
||||
- 不要创建分支
|
||||
- 不要切换分支
|
||||
- 不要修改当前主 worktree 所在分支
|
||||
- spec/plan 一律在 main 分支(当前主 worktree)创建
|
||||
- 除 PRD / 计划文件外不要改动或提交任何文件
|
||||
@@ -1,4 +1,6 @@
|
||||
/goal 使用子代理全程绿灯实施 @{planFile},发起 PR 时务必在 PR body 中包含 "Closes #{issueNumber}"。
|
||||
/ecc:tdd-workflow @{planFile}
|
||||
|
||||
按计划实施 {issueNumber} 号工单:具体编码派子代理去做,全程保持测试绿灯。计划里的验证命令只当意图,落地时用仓库自己的 test / lint / typecheck 命令。提 PR 前先 `/ecc:code-review` 自审并修掉严重问题。发起 PR 时务必在 PR body 中包含 "Closes #{issueNumber}"。
|
||||
|
||||
**严禁合并 PR**:你的职责只到发起 PR 为止,后续审查反馈到了请继续修复并 push,永远不要执行 `tea pulls merge` 或任何合并操作。
|
||||
|
||||
|
||||
@@ -5,14 +5,19 @@ import * as path from 'node:path'
|
||||
export const DEFAULT_WORKTREE_TEMPLATE = '~/Sources/worktree/$project_name/$feature_name'
|
||||
|
||||
/**
|
||||
* spec/plan 以目录形式存放(docs/superpowers/{specs,plans}/<slug>/…),slug 取
|
||||
* `plans`/`specs` 后一段。兜底父目录名,再兜底路径 hash,保证目录名不为空。
|
||||
* PRD / 计划按 ECC 布局存放:`.claude/prds/<slug>.prd.md`、`.claude/plans/<slug>.plan.md`。
|
||||
* slug 取 `plans` / `prds` / `specs` 后一段并去掉 `.plan.md` / `.prd.md` / `.md` 后缀。
|
||||
* 兜底父目录名,再兜底路径 hash,保证目录名不为空。
|
||||
*/
|
||||
export function deriveSlug(planFile: string): string {
|
||||
const segments = planFile.split('/').filter(Boolean)
|
||||
const anchor = segments.findIndex(s => s === 'plans' || s === 'specs')
|
||||
if (anchor >= 0 && segments[anchor + 1])
|
||||
return segments[anchor + 1]
|
||||
const anchor = segments.findIndex(s => s === 'plans' || s === 'prds' || s === 'specs')
|
||||
const next = anchor >= 0 ? segments[anchor + 1] : undefined
|
||||
if (next) {
|
||||
const slug = next.replace(/\.(?:plan|prd)\.md$|\.md$/, '')
|
||||
if (slug)
|
||||
return slug
|
||||
}
|
||||
const parent = path.basename(path.dirname(planFile))
|
||||
if (parent && parent !== '.' && parent !== '/')
|
||||
return parent
|
||||
|
||||
@@ -48,13 +48,13 @@ export interface Issue {
|
||||
/**
|
||||
* Optional workspace-relative path to the spec file for this issue, as
|
||||
* surfaced from the Claude session transcript. Lives under
|
||||
* `docs/superpowers/specs/*.md`.
|
||||
* `.claude/prds/<slug>.prd.md`.
|
||||
*/
|
||||
specFile?: string
|
||||
/**
|
||||
* Optional workspace-relative path to the plan file for this issue, as
|
||||
* surfaced from the Claude session transcript. Lives under
|
||||
* `docs/superpowers/plans/*.md`.
|
||||
* `.claude/plans/<slug>.plan.md`.
|
||||
*/
|
||||
planFile?: string
|
||||
/** Optional workspace-relative path to the generated PR diff summary. */
|
||||
|
||||
@@ -791,7 +791,7 @@ export class KanbanWebviewPanel {
|
||||
* 3. Confirm the always-on webhook coordinator is bound to the current
|
||||
* port, then register a gitea webhook scoped to the feature branch
|
||||
* and hand the bookkeeping to the coordinator.
|
||||
* 4. Spawn `claude` in an editor-tab terminal with a /goal prompt that
|
||||
* 4. Spawn `claude` in an editor-tab terminal with the implement prompt that
|
||||
* tells cc to create the worktree, implement the plan, and emit
|
||||
* `<request_review>$pr_no</request_review>` when done.
|
||||
*
|
||||
|
||||
@@ -632,7 +632,7 @@ async function triggerAutoReviewTabUnlocked(panel: KanbanWebviewPanel, opts: {
|
||||
* 3. Confirm the always-on webhook coordinator is bound to the current
|
||||
* port, then register a gitea webhook scoped to the feature branch
|
||||
* and hand the bookkeeping to the coordinator.
|
||||
* 4. Spawn `claude` in an editor-tab terminal with a /goal prompt that
|
||||
* 4. Spawn `claude` in an editor-tab terminal with the implement prompt that
|
||||
* tells cc to create the worktree, implement the plan, and emit
|
||||
* `<request_review>$pr_no</request_review>` when done.
|
||||
*
|
||||
|
||||
@@ -24,11 +24,11 @@ import { normalizeReleasePrefix } from '../git/release'
|
||||
* users can tweak them without rebuilding. These short fallbacks just keep
|
||||
* the extension usable if the file is missing/corrupt.
|
||||
*/
|
||||
const FALLBACK_BRAINSTORM_PROMPT = `/goal 我现在有这样一个需求 {userRequest},你用 spx 命令创建 gitea 工单。工单 body 末尾必须包含 <!-- spx:nonce={nonce} -->。创建完工单立即停下汇报,不要擅自实施。`
|
||||
const FALLBACK_BRAINSTORM_PROMPT = `我现在有这样一个需求 {userRequest},你用 spx 命令创建 gitea 工单。工单 body 末尾必须包含 <!-- spx:nonce={nonce} -->。创建完工单立即停下汇报,不要擅自实施。`
|
||||
|
||||
const FALLBACK_BRAINSTORM_CONTINUE_PROMPT = `/superpowers:brainstorming 讨论下 {issueNumber} 号工单。注意:不要 git checkout / 不要写代码 / 不要建 PR,只讨论需求与 spec/plan,用 spx issue marker 更新 marker。`
|
||||
const FALLBACK_BRAINSTORM_CONTINUE_PROMPT = `/ecc:plan-prd 讨论下 {issueNumber} 号工单。PRD 写到 .claude/prds/<slug>.prd.md,我确认后用 ecc:plan 出 .claude/plans/<slug>.plan.md,两个文件在 main 上提交并用 spx issue marker 同步 marker。不要 git checkout / 不要写代码 / 不要建 PR。`
|
||||
|
||||
const FALLBACK_IMPLEMENT_PLAN_PROMPT = `/goal 使用子代理全程绿灯实施 @{planFile},发起 PR 时在 body 中包含 "Closes #{issueNumber}"。严禁合并 PR。`
|
||||
const FALLBACK_IMPLEMENT_PLAN_PROMPT = `/ecc:tdd-workflow @{planFile} 按计划实施,编码派子代理,发起 PR 时在 body 中包含 "Closes #{issueNumber}"。严禁合并 PR。`
|
||||
|
||||
const FALLBACK_REVIEW_PROMPT = `/review 用 tea 拿到 #{prNumber} PR 审查。审查意见用 spx pr review-comment 发评论,body 第一行写 <!-- spx:review=1 -->。`
|
||||
|
||||
|
||||
@@ -1,20 +1,29 @@
|
||||
import * as os from 'node:os'
|
||||
import * as path from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { DEFAULT_WORKTREE_TEMPLATE, deriveSlug, resolveWorktreeDir, slugFromBranch } from './worktreePath'
|
||||
import { DEFAULT_WORKTREE_TEMPLATE, deriveSlug, resolveWorktreeDir, slugFromBranch } from '../../src/git/worktreePath'
|
||||
|
||||
describe('deriveSlug', () => {
|
||||
it('取 plans/ 后一段', () => {
|
||||
expect(deriveSlug('docs/superpowers/plans/foo-bar/plan.md')).toBe('foo-bar')
|
||||
it('plans/ 后一段去掉 .plan.md', () => {
|
||||
expect(deriveSlug('.claude/plans/app-entity.plan.md')).toBe('app-entity')
|
||||
})
|
||||
it('没有 plans/specs 锚点时退回父目录名', () => {
|
||||
expect(deriveSlug('docs/x/baz/plan.md')).toBe('baz')
|
||||
it('prds/ 后一段去掉 .prd.md', () => {
|
||||
expect(deriveSlug('.claude/prds/app-entity.prd.md')).toBe('app-entity')
|
||||
})
|
||||
it('目录形式取 plans/ 后的目录名', () => {
|
||||
expect(deriveSlug('docs/superpowers/plans/x/plan.md')).toBe('x')
|
||||
})
|
||||
it('没有 plans/prds/specs 锚点时退回父目录名', () => {
|
||||
expect(deriveSlug('foo/bar/notes.md')).toBe('bar')
|
||||
})
|
||||
it('没有父目录时退回路径 hash 前 8 位', () => {
|
||||
expect(deriveSlug('notes.md')).toMatch(/^[0-9a-f]{8}$/)
|
||||
})
|
||||
})
|
||||
|
||||
describe('slugFromBranch', () => {
|
||||
it('去掉 feature/ 前缀', () => {
|
||||
expect(slugFromBranch('feature/foo-bar')).toBe('foo-bar')
|
||||
expect(slugFromBranch('feature/app-entity')).toBe('app-entity')
|
||||
})
|
||||
it('无前缀原样返回', () => {
|
||||
expect(slugFromBranch('hotfix-1')).toBe('hotfix-1')
|
||||
@@ -29,13 +29,13 @@ export interface Issue {
|
||||
/**
|
||||
* Optional workspace-relative path to the spec file for this issue, as
|
||||
* surfaced from the Claude session transcript. Lives under
|
||||
* `docs/superpowers/specs/*.md`.
|
||||
* `.claude/prds/<slug>.prd.md`.
|
||||
*/
|
||||
specFile?: string
|
||||
/**
|
||||
* Optional workspace-relative path to the plan file for this issue, as
|
||||
* surfaced from the Claude session transcript. Lives under
|
||||
* `docs/superpowers/plans/*.md`.
|
||||
* `.claude/plans/<slug>.plan.md`.
|
||||
*/
|
||||
planFile?: string
|
||||
/** Optional workspace-relative path to the generated PR diff summary. */
|
||||
|
||||
Reference in new issue
Block a user