✨ feat(vscode): 原型提示词改用通用技能,测试提示词带上合入判断
This commit is contained in:
1 parent
53b5a8021f
commit
12d9080248
5 files changed
+66
-4
No files matched your search
@@ -1,3 +1,11 @@
|
||||
/ecc:figma-plugin-prototyping 给 {{issueNumber}} 号工单画原型:先读工单正文锁定要画的界面和状态,再写本地 Figma 插件把画板和点击流做出来。画完汇报插件路径和怎么导入,不要改业务代码。
|
||||
/ecc:ui-prototyping 给 {{issueNumber}} 号工单画原型。
|
||||
|
||||
画完用 `opencli spx issue marker --issue {{issueNumber}} --type prototype --value <manifest.json 的仓库相对路径>` 把原型插件挂到工单上,再汇报。
|
||||
先读工单正文,锁定要确认的界面和状态。画法按这个技能来:工单正文已经指定 Figma 插件或 OpenPencil 就用指定的那个;没指定就先问用哪一个,再按技能里对应的做法画。不要改业务代码。
|
||||
|
||||
画完把原型源文件的仓库相对路径挂到工单上:
|
||||
|
||||
```
|
||||
opencli spx issue marker --issue {{issueNumber}} --type prototype --value <路径>
|
||||
```
|
||||
|
||||
Figma 插件填 `manifest.json` 的路径,OpenPencil 填画板文件的路径。挂完再汇报路径和怎么打开。
|
||||
@@ -1,3 +1,5 @@
|
||||
/pr-acceptance-testing 验收 {{issueNumber}} 号工单({{prRef}})。
|
||||
|
||||
验收目标以工单正文为准,不要再问验收哪个。测出问题就停下报告,不要顺手改代码。
|
||||
|
||||
先看下目前有没有合进main 如果已经手动合过了 就发main到测试服验证 如果没合 就发当前pr对应的分支去测试服验证
|
||||
@@ -4,8 +4,10 @@ import { describe, expect, it } from 'vitest'
|
||||
import { PREVIOUS_DEFAULT_REVIEW_PROMPT } from './previousReviewPrompt'
|
||||
import {
|
||||
composeBrainstormTemplate,
|
||||
planDefaultPromptReplacement,
|
||||
planPromptMigration,
|
||||
planReviewPromptMigration,
|
||||
PREVIOUS_PROTOTYPE_PROMPTS,
|
||||
PROMPT_TEMPLATE_VERSION,
|
||||
splitIfBlock,
|
||||
upgradePlaceholders,
|
||||
@@ -189,3 +191,15 @@ describe('planReviewPromptMigration', () => {
|
||||
expect(planReviewPromptMigration(undefined, PREVIOUS_DEFAULT_REVIEW_PROMPT, nextDefault)).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('planDefaultPromptReplacement', () => {
|
||||
it('旧的 Figma 插件提示词换成通用技能', () => {
|
||||
const next = '/ecc:ui-prototyping 给 {{issueNumber}} 号工单画原型。\n'
|
||||
const out = planDefaultPromptReplacement(PREVIOUS_PROTOTYPE_PROMPTS[0], PREVIOUS_PROTOTYPE_PROMPTS, next, '已换成通用技能')
|
||||
expect(out?.prompt).toBe(next)
|
||||
})
|
||||
|
||||
it('改过的提示词不动', () => {
|
||||
expect(planDefaultPromptReplacement('我自己写的原型提示词', PREVIOUS_PROTOTYPE_PROMPTS, '新的', '已换')).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -237,3 +237,31 @@ export function planReviewPromptMigration(
|
||||
notes: [{ level: 'info', message: '审查提示词末尾已追加「审查结论」,其余段落未改' }],
|
||||
}
|
||||
}
|
||||
|
||||
/** 存的提示词和旧默认一样时,整段换成新默认。改过的不动。 */
|
||||
export function planDefaultPromptReplacement(
|
||||
stored: unknown,
|
||||
previousDefaults: string[],
|
||||
nextDefault: string,
|
||||
note: string,
|
||||
): { prompt: string, notes: MigrationNote[] } | null {
|
||||
if (typeof stored !== 'string' || stored.length === 0)
|
||||
return null
|
||||
const now = normalizePrompt(stored)
|
||||
const next = normalizePrompt(nextDefault)
|
||||
if (!next || now === next)
|
||||
return null
|
||||
if (!previousDefaults.some(prev => normalizePrompt(prev) === now))
|
||||
return null
|
||||
return {
|
||||
prompt: nextDefault.endsWith('\n') ? nextDefault : `${nextDefault}\n`,
|
||||
notes: [{ level: 'info', message: note }],
|
||||
}
|
||||
}
|
||||
|
||||
export const PREVIOUS_PROTOTYPE_PROMPTS = [
|
||||
'/ecc:figma-plugin-prototyping 给 {{issueNumber}} 号工单画原型:先读工单正文锁定要画的界面和状态,再写本地 Figma 插件把画板和点击流做出来。画完汇报插件路径和怎么导入,不要改业务代码。',
|
||||
`/ecc:figma-plugin-prototyping 给 {{issueNumber}} 号工单画原型:先读工单正文锁定要画的界面和状态,再写本地 Figma 插件把画板和点击流做出来。画完汇报插件路径和怎么导入,不要改业务代码。
|
||||
|
||||
画完用 \`opencli spx issue marker --issue {{issueNumber}} --type prototype --value <manifest.json 的仓库相对路径>\` 把原型插件挂到工单上,再汇报。`,
|
||||
]
|
||||
@@ -19,7 +19,7 @@ import { seedCommitProfilePath } from '../cc/commitProfile'
|
||||
import { listClaudeProfiles } from '../cc/profiles'
|
||||
import { normalizeReleasePrefix } from '../git/release'
|
||||
import { PREVIOUS_DEFAULT_REVIEW_PROMPT } from './previousReviewPrompt'
|
||||
import { planPromptMigration, planReviewPromptMigration } from './promptMigration'
|
||||
import { planDefaultPromptReplacement, planPromptMigration, planReviewPromptMigration, PREVIOUS_PROTOTYPE_PROMPTS } from './promptMigration'
|
||||
|
||||
/**
|
||||
* Fallback prompt strings used when the on-disk markdown can't be read.
|
||||
@@ -524,9 +524,17 @@ export function migratePromptTemplates(ctx: ExtensionContext): MigrationNote[] {
|
||||
PREVIOUS_DEFAULT_REVIEW_PROMPT,
|
||||
readDefaultPrompt(ctx.extensionPath, 'review'),
|
||||
)
|
||||
const blob = review
|
||||
let blob = review
|
||||
? { ...(planned.blob ?? stored), reviewPrompt: review.prompt }
|
||||
: planned.blob
|
||||
const prototype = planDefaultPromptReplacement(
|
||||
(blob ?? stored).prototypePrompt,
|
||||
PREVIOUS_PROTOTYPE_PROMPTS,
|
||||
readDefaultPrompt(ctx.extensionPath, 'prototype'),
|
||||
'原型提示词还是旧的 Figma 插件技能,已换成通用的 ui-prototyping',
|
||||
)
|
||||
if (prototype)
|
||||
blob = { ...(blob ?? stored), prototypePrompt: prototype.prompt }
|
||||
if (!blob)
|
||||
return []
|
||||
const out: MigrationNote[] = []
|
||||
@@ -548,6 +556,8 @@ export function migratePromptTemplates(ctx: ExtensionContext): MigrationNote[] {
|
||||
out.push(...planned.notes)
|
||||
if (review)
|
||||
out.push(...review.notes)
|
||||
if (prototype)
|
||||
out.push(...prototype.notes)
|
||||
if (planned.blob)
|
||||
out.push({ level: 'info', message: '提示词模板已迁到 Handlebars' })
|
||||
return out
|
||||
|
||||
Reference in new issue
Block a user