Files
tea-sdlc/test/wp-schedule-assets.test.js
T
jiantw83andClaude Opus 5 7ee050de2f 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>
2026-09-17 19:32:37 +08:00

69 lines
2.7 KiB
JavaScript

/**
* 正本第三段「排上時程與看板」的規則。
*/
import test from 'node:test';
import assert from 'node:assert/strict';
import { assertNeutralPrompt, readPrompt } from './helpers/prompt-doc.js';
const prompt = readPrompt('sdlc-analyze');
const phase3 = prompt.slice(prompt.indexOf('## 第三段'), prompt.indexOf('## 架構圖的限制'));
test('正本仍然平台中立,description 前綴正確', () => {
assertNeutralPrompt(prompt, 'sdlc-analyze');
});
test('第三段指名四支腳本,順序為先算再寫', () => {
const order = ['schedule.js', 'issue-link.js', 'issue-update.js', 'project-add.js'];
const positions = order.map((name) => phase3.indexOf(name));
assert.equal(positions.every((p) => p >= 0), true, '四支腳本都要被指名');
assert.deepEqual([...positions].sort((a, b) => a - b), positions, '要先算出截止日才寫得下去');
});
test('計畫檔的格式有可照抄的範例', () => {
assert.match(phase3, /"startDate"/);
assert.match(phase3, /"workPackages"/);
assert.match(phase3, /"depends"/);
});
test('交代了拓撲排序保證什麼,以及成環時怎麼辦', () => {
assert.match(phase3, /截止日都不早於它的先決/);
assert.match(phase3, /成環/);
assert.match(phase3, /回頭改拆法/);
});
test('說明日期只算日曆日,不替使用者決定跳哪些日子', () => {
assert.match(phase3, /日曆日/);
assert.match(phase3, /不跳週末/);
});
test('三支寫入腳本都要求先試跑,並點出它們是冪等的', () => {
assert.match(phase3, /--dry-run/);
assert.match(phase3, /冪等/);
});
test('Milestone 與看板都只掛既有的,且交代反查不到時怎麼辦', () => {
assert.match(phase3, /只掛既有的/);
assert.match(phase3, /不建立 Milestone/);
assert.match(phase3, /不建立專案/);
assert.match(phase3, /貼專案網址/);
});
test('回報時要指出相依鏈最長路徑', () => {
assert.match(phase3, /相依鏈最長路徑/);
});
test('人天估算的 API 限制寫成獨立一節,不是藏在行文裡', () => {
const limit = prompt.slice(prompt.indexOf('## 已知限制'), prompt.indexOf('## 架構圖的限制'));
assert.match(limit, /time_estimate/);
assert.match(limit, /無法由 API 寫入/);
assert.match(limit, /估算人天:/, '要說清楚改寫到哪裡去');
assert.match(limit, /sdlc-report/, '要說清楚誰會讀這一行');
});
test('邊界把三段各自不做的事分開列', () => {
const boundary = prompt.slice(prompt.indexOf('## 邊界'));
assert.match(boundary, /共識摘要之前不對 Gitea 寫入任何內容/);
assert.match(boundary, /第二段只建立工作包議題/);
assert.match(boundary, /第三段只掛既有的 Milestone 與看板/);
});