🐛 fix(vscode): 提示词对齐 ECC 实际命令,需求文档改走 specs 布局

头脑风暴、实施、审查三套提示词引用的 /ecc:plan-prd、grill-me、
/ecc:tdd-workflow、/review 在 ECC 2.2.15 里都不存在,会话拿到的是一
条无效命令。审查提示词里的 /ecc:review-pr 走 gh,对 Gitea 不可用。

改为 ECC 实际链路:/ecc:grilling 讨论、/ecc:spec 出设计文档、
/ecc:plan 出计划、/ecc:tdd 实施,审查直接派 ecc:code-reviewer 等子代
理审 git diff。文档路径随 ECC 约定改成 .claude/specs/<stem>.md 与
.claude/plans/<stem>.md,stem 两者共用,不再带 .prd.md / .plan.md 后
缀;deriveSlug 相应改成取文件名 stem,通用文件名才退回目录名。

Claude-Session: https://claude.ai/code/session_01REdhpbaNyqWASF2HWsnTFv
This commit is contained in:
cruldra committed 2026-09-13 08:44:19 +08:00
1 parent ef0750b4ef
commit 518d471b7a
11 files changed
+60 -58

No files matched your search

+6 -11
View File
@@ -5,19 +5,14 @@ import * as path from 'node:path'
export const DEFAULT_WORKTREE_TEMPLATE = '~/Sources/worktree/$project_name/$feature_name'
/**
* PRD / 计划按 ECC 布局存放:`.claude/prds/<slug>.prd.md`、`.claude/plans/<slug>.plan.md`。
* slug 取 `plans` / `prds` / `specs` 后一段并去掉 `.plan.md` / `.prd.md` / `.md` 后缀。
* 兜底父目录名,再兜底路径 hash,保证目录名不为空。
* 设计文档 / 计划按 ECC 布局存放:`.claude/specs/<stem>.md`、`.claude/plans/<stem>.md`,
* 文件名的 stem 就是 slug,两者共用同一个 stem。少数布局把文件名固定成
* `plan.md` / `spec.md`,这时 slug 退回父目录名;再兜底路径 hash,保证不为空。
*/
export function deriveSlug(planFile: string): string {
const segments = planFile.split('/').filter(Boolean)
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 stem = path.basename(planFile).replace(/\.md$/, '')
if (stem && stem !== 'plan' && stem !== 'spec')
return stem
const parent = path.basename(path.dirname(planFile))
if (parent && parent !== '.' && parent !== '/')
return parent
+2 -2
View File
@@ -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
* `.claude/prds/<slug>.prd.md`.
* `.claude/specs/<stem>.md`.
*/
specFile?: string
/**
* Optional workspace-relative path to the plan file for this issue, as
* surfaced from the Claude session transcript. Lives under
* `.claude/plans/<slug>.plan.md`.
* `.claude/plans/<stem>.md`.
*/
planFile?: string
/** Optional workspace-relative path to the generated PR diff summary. */
+3 -3
View File
@@ -26,11 +26,11 @@ import { normalizeReleasePrefix } from '../git/release'
*/
const FALLBACK_BRAINSTORM_PROMPT = `我现在有这样一个需求 {userRequest},你用 spx 命令创建 gitea 工单。工单 body 末尾必须包含 <!-- spx:nonce={nonce} -->。创建完工单立即停下汇报,不要擅自实施。`
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_BRAINSTORM_CONTINUE_PROMPT = `/ecc:grilling 讨论下 {issueNumber} 号工单。达成共识后用 ecc:spec 写 .claude/specs/<stem>.md,我确认后用 ecc:plan 出 .claude/plans/<stem>.md,两个文件在 main 上提交并用 spx issue marker 同步 marker。不要 git checkout / 不要写代码 / 不要建 PR。`
const FALLBACK_IMPLEMENT_PLAN_PROMPT = `/ecc:tdd-workflow @{planFile} 按计划实施,编码派子代理,发起 PR 时在 body 中包含 "Closes #{issueNumber}"。严禁合并 PR。`
const FALLBACK_IMPLEMENT_PLAN_PROMPT = `/ecc:tdd @{planFile} 按计划实施,编码派子代理,发起 PR 时在 body 中包含 "Closes #{issueNumber}"。严禁合并 PR。`
const FALLBACK_REVIEW_PROMPT = `/review 用 tea 拿到 #{prNumber} PR 审查。审查意见用 spx pr review-comment 发评论,body 第一行写 <!-- spx:review=1 -->。`
const FALLBACK_REVIEW_PROMPT = `用 tea 拿到 #{prNumber} PR,diff 交给 ecc:code-reviewer 子代理审查。审查意见用 spx pr review-comment 发评论,body 第一行写 <!-- spx:review=1 -->。`
type PromptName = 'brainstorm' | 'brainstorm-continue' | 'implement-plan' | 'review'