♻️ refactor(vscode): 续聊里的原型段落搬进模板文件

那段正文原先拼在 prompts.ts 里,设置面板看不到也改不了。现在落到
prompts/brainstorm-continue-prototype.md,面板「提示词」组多一项「续聊·原型段落」,
占位符 {prototypeFile} / {issueNumber} / {prototypeSessionId};取值为空的整行会被
删掉,免得留下半句没有值的说明。

同时把措辞收紧:原型改动只能 ListAgents + SendMessage 给已开着的原型会话,
点名禁止派子代理 / fork 分身 / 自己动插件代码。

Claude-Session: https://claude.ai/code/session_01Kgmb1LvrPmFX3NoUDB4zZC
This commit is contained in:
cruldra committed 2026-09-15 00:28:58 +08:00
1 parent f9537abf97
commit 43a0bf6bad
10 files changed
+84 -17

No files matched your search

+14 -1
View File
@@ -36,13 +36,15 @@ const FALLBACK_IMPLEMENT_PLAN_PROMPT = `/ecc:tdd @{planFile} 按计划实施,
const FALLBACK_TEST_PROMPT = `/pr-acceptance-testing 验收 {issueNumber} 号工单({prRef})。验收目标以工单正文为准,不要再问验收哪个。`
const FALLBACK_PROTOTYPE_REF_PROMPT = `工单已有原型插件 {prototypeFile},先读它。原型要改就 ListAgents 找到 issue-{issueNumber}-原型 会话(id {prototypeSessionId})并 SendMessage 给它,不要派子代理、不要自己动插件代码。`
const FALLBACK_REVIEW_PROMPT = `用 tea 拿到 #{prNumber} PR,diff 交给 ecc:code-reviewer 子代理审查。审查意见用 spx pr review-comment 发评论,body 第一行写 <!-- spx:review=1 -->。`
const FALLBACK_PROTOTYPE_PROMPT = `/ecc:figma-plugin-prototyping 给 {issueNumber} 号工单画原型:先读工单正文锁定要画的界面和状态,再写本地 Figma 插件把画板和点击流做出来。画完汇报插件路径和怎么导入,不要改业务代码。
画完用 \`opencli spx issue marker --issue {issueNumber} --type prototype --value <manifest.json 的仓库相对路径>\` 把原型插件挂到工单上,再汇报。`
type PromptName = 'brainstorm' | 'brainstorm-continue' | 'implement-plan' | 'review' | 'test' | 'prototype'
type PromptName = 'brainstorm' | 'brainstorm-continue' | 'brainstorm-continue-prototype' | 'implement-plan' | 'review' | 'test' | 'prototype'
/**
* Read a default prompt template from `${extensionPath}/prompts/${name}.md`.
@@ -62,6 +64,7 @@ export function readDefaultPrompt(extensionPath: string, name: PromptName): stri
switch (name) {
case 'brainstorm': return FALLBACK_BRAINSTORM_PROMPT
case 'brainstorm-continue': return FALLBACK_BRAINSTORM_CONTINUE_PROMPT
case 'brainstorm-continue-prototype': return FALLBACK_PROTOTYPE_REF_PROMPT
case 'implement-plan': return FALLBACK_IMPLEMENT_PLAN_PROMPT
case 'review': return FALLBACK_REVIEW_PROMPT
case 'test': return FALLBACK_TEST_PROMPT
@@ -94,6 +97,11 @@ export interface Settings {
* 无则连同所在段落一起删掉)。
*/
brainstormContinuePrompt: string
/**
* 续聊提示词里 `{prototypeRef}` 那段的正文;只在工单挂了原型插件时填进去。
* 占位符 {prototypeFile} / {issueNumber} / {prototypeSessionId}。
*/
prototypeRefPrompt: string
/** Prompt template for the implement-plan flow. `{planFile}` placeholder. */
implementPlanPrompt: string
/** Whether to automatically run `codex exec review` when a PR opens. */
@@ -282,6 +290,7 @@ function defaults(ctx: ExtensionContext): Settings {
webhookSecret: '',
brainstormPrompt: readDefaultPrompt(ctx.extensionPath, 'brainstorm'),
brainstormContinuePrompt: readDefaultPrompt(ctx.extensionPath, 'brainstorm-continue'),
prototypeRefPrompt: readDefaultPrompt(ctx.extensionPath, 'brainstorm-continue-prototype'),
implementPlanPrompt: readDefaultPrompt(ctx.extensionPath, 'implement-plan'),
autoReview: true,
reviewPrompt: readDefaultPrompt(ctx.extensionPath, 'review'),
@@ -334,6 +343,9 @@ export function getSettings(ctx: ExtensionContext): Settings {
const brainstormContinuePrompt = typeof stored.brainstormContinuePrompt === 'string' && stored.brainstormContinuePrompt.length > 0
? stored.brainstormContinuePrompt
: base.brainstormContinuePrompt
const prototypeRefPrompt = typeof stored.prototypeRefPrompt === 'string' && stored.prototypeRefPrompt.length > 0
? stored.prototypeRefPrompt
: base.prototypeRefPrompt
const implementPlanPrompt = typeof stored.implementPlanPrompt === 'string' && stored.implementPlanPrompt.length > 0
? stored.implementPlanPrompt
: base.implementPlanPrompt
@@ -452,6 +464,7 @@ export function getSettings(ctx: ExtensionContext): Settings {
webhookSecret,
brainstormPrompt,
brainstormContinuePrompt,
prototypeRefPrompt,
implementPlanPrompt,
autoReview,
reviewPrompt,