docs(sdlc-plan,sdlc-analyze): 兩份正本各自起停自己的錶
起錶與停錶寫在同一份正本裡成對出現,讀的人一眼看得出這段計時涵蓋到哪;兩份各加一節 「計時範圍」把兩端指出來。 sdlc-plan 記兩段:議題建立之前那段在第一步記下開始時間、議題建立之後以補登記上去; 之後起錶,回報那一步停錶。補登排在議題建立之後、起錶之前,順序反過來的話補登會被 time-log 當成「這一步做過了」而跳過。 sdlc-analyze 在它分析的那顆需求議題上起錶,起點放在第一段開頭——分析最耗時的正是 共識之前那一段,從第二段才起的話那段時間永遠是零。因此「共識摘要之前不對 Gitea 產生任何寫入」改寫成「不寫入任何**內容**」,並把碼錶明文除外、寫上理由:它記的是 工時,不是內容。這一條與 repo 擁有者確認過。 sdlc-feat 的「碼錶一律由使用者自己停」收斂成「**別顆議題上的**錶一律由使用者自己停」 ——它原本讀起來像全域規則,而現在每道指令都會停自己起的那一支。 正本之間改以步驟**名稱**互指,不用編號:編號會整批位移,名字不會。測試跟著改用新的 promptStep 輔助函式,以名字框出某一步的內容,別人插一步時不會無聲地框到另一段上。 議題 #57 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
assertNeutralPrompt,
|
||||
assertPromptListsSections,
|
||||
assertTemplateSections,
|
||||
promptStep,
|
||||
readPrompt,
|
||||
readTemplate,
|
||||
} from './helpers/prompt-doc.js';
|
||||
@@ -19,6 +20,9 @@ import {
|
||||
const template = readTemplate('requirement-issue');
|
||||
const prompt = readPrompt('sdlc-plan');
|
||||
|
||||
/** 某一步在正本裡的位置;以名字取而不是以編號取,插一步不會讓這些測試框錯段落 */
|
||||
const at = (name) => prompt.indexOf(promptStep(prompt, name));
|
||||
|
||||
/** 需求議題的九個段落,順序即議題裡的順序 */
|
||||
const SECTIONS = [
|
||||
'總覽',
|
||||
@@ -99,3 +103,46 @@ test('正本交代了畫與不畫兩種情況各該填什麼', () => {
|
||||
assert.match(prompt, /```mermaid/);
|
||||
assert.match(prompt, /不要加圍欄|不加圍欄/);
|
||||
});
|
||||
|
||||
// ── 計時 ───────────────────────────────────────────────────────────
|
||||
|
||||
test('正本寫出這段計時涵蓋到哪,讀的人不必自己推', () => {
|
||||
assert.match(prompt, /## 計時範圍/);
|
||||
assert.match(prompt, /錶不跨階段跑/);
|
||||
});
|
||||
|
||||
test('議題建立之前先記下開始時間:那時候還沒有標的可起錶', () => {
|
||||
assert.ok(at('記下開始時間') < at('先試跑,再寫入'), '要在議題建立之前就記下');
|
||||
assert.match(promptStep(prompt, '記下開始時間'), /不要憑印象回推/);
|
||||
});
|
||||
|
||||
test('補登排在議題建立之後、起錶之前,三者指向同一顆議題', () => {
|
||||
const 補登 = prompt.indexOf('time-log.js');
|
||||
const 起錶 = prompt.indexOf('timer.js');
|
||||
assert.ok(at('先試跑,再寫入') < 補登, '議題還不存在時無處可補');
|
||||
assert.ok(補登 < 起錶, '順序反過來的話補登會被當成做過了而跳過');
|
||||
for (const line of [...prompt.matchAll(/node scripts\/(?:time-log|timer)\.js[^\n]*/g)]) {
|
||||
assert.match(line[0], /--index <編號>/, `補登與起錶要指向同一顆議題:${line[0]}`);
|
||||
}
|
||||
});
|
||||
|
||||
test('補登的長度由腳本算,不要 agent 自己做減法', () => {
|
||||
assert.match(prompt, /--since <記下的開始時間>/);
|
||||
assert.match(prompt, /不必自己做減法/);
|
||||
});
|
||||
|
||||
test('補登不設時間上限,也不因為時間長就改口問使用者', () => {
|
||||
assert.match(prompt, /不設時間上限/);
|
||||
assert.match(prompt, /不必為此多長一題出來問使用者/);
|
||||
});
|
||||
|
||||
test('停錶排在最後的回報那一步,與起錶成對', () => {
|
||||
assert.match(promptStep(prompt, '停錶並回報'), /--stop/, '停錶與回報寫在同一步');
|
||||
assert.ok(at('補登規劃時間,然後起錶') < at('停錶並回報'), '先起才有得停');
|
||||
});
|
||||
|
||||
test('正本明令不代停別顆議題上的錶', () => {
|
||||
assert.match(prompt, /請他自己去停/);
|
||||
const boundary = prompt.slice(prompt.indexOf('## 邊界'));
|
||||
assert.match(boundary, /不停別顆議題上的錶/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user