第一段到共識摘要為止仍然完全不寫入;使用者點頭之後才進入第二段建立議題。 邊界條文隨之改寫成「共識摘要之前不對 Gitea 產生任何寫入」,並明列第二段 不做的事:不建相依、不掛 Milestone、不加看板、不寫人天估算——那些是後續 流程的工作,寫在這裡會讓兩顆工作包互相踩。 工作包的切法、標題規則(動詞加名詞、禁止 WP-01 這類流水編號)、待辦與驗收 的巢狀寫法(附可照抄的範例)、架構圖依性質三選一,都在這一段定下來。 邊界的斷言跟著條文一起改,因為條文換了語意;分開成兩顆 commit 的話中間那顆 會是紅的。另補一條斷言:第一段不得出現任何寫入型腳本的名字。 Closes #7 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
113 lines
4.9 KiB
JavaScript
113 lines
4.9 KiB
JavaScript
/**
|
|
* sdlc-analyze 的交付物:四份可行性檢查清單與流程正本。
|
|
* 這一段不寫入 Gitea,所以沒有腳本——交付的就是這些文件本身。
|
|
*/
|
|
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { assertNeutralPrompt, readPrompt, readReference } from './helpers/prompt-doc.js';
|
|
|
|
const prompt = readPrompt('sdlc-analyze');
|
|
|
|
/** 四類檢查,順序即提問順序 */
|
|
const CHECKS = [
|
|
{ kind: '架構', file: 'feasibility-architecture' },
|
|
{ kind: '邏輯', file: 'feasibility-logic' },
|
|
{ kind: '資料', file: 'feasibility-data' },
|
|
{ kind: '時程', file: 'feasibility-schedule' },
|
|
];
|
|
|
|
// ── 規則正本 ───────────────────────────────────────────────────────
|
|
|
|
test('四份可行性檢查清單各自存在且有檢查項', () => {
|
|
for (const { kind, file } of CHECKS) {
|
|
const reference = readReference(file);
|
|
const items = [...reference.matchAll(/^\d+\.\s+\*\*(.+?)\*\*/gm)];
|
|
assert.ok(items.length >= 4, `${kind}清單至少要有四條檢查項,目前 ${items.length} 條`);
|
|
}
|
|
});
|
|
|
|
test('每份清單都交代了「問題怎麼問」,不只列檢查項', () => {
|
|
for (const { kind, file } of CHECKS) {
|
|
assert.match(readReference(file), /## 問題怎麼問/, `${kind}清單缺少提問指引`);
|
|
}
|
|
});
|
|
|
|
test('各清單涵蓋議題點名的重點', () => {
|
|
assert.match(readReference('feasibility-architecture'), /循環相依/);
|
|
assert.match(readReference('feasibility-logic'), /既有功能/);
|
|
assert.match(readReference('feasibility-data'), /schema/);
|
|
assert.match(readReference('feasibility-data'), /遷移/);
|
|
assert.match(readReference('feasibility-data'), /交易邊界/);
|
|
assert.match(readReference('feasibility-schedule'), /最長路徑/);
|
|
assert.match(readReference('feasibility-schedule'), /未知數最大/);
|
|
});
|
|
|
|
// ── 流程正本 ───────────────────────────────────────────────────────
|
|
|
|
test('正本平台中立,description 前綴正確', () => {
|
|
assertNeutralPrompt(prompt, 'sdlc-analyze');
|
|
});
|
|
|
|
test('正本逐一指名四份規則正本,且順序為架構→邏輯→資料→時程', () => {
|
|
const positions = CHECKS.map(({ file }) => prompt.indexOf(`references/${file}.md`));
|
|
assert.equal(positions.every((p) => p >= 0), true, '四份清單都要被正本指名讀取');
|
|
assert.deepEqual([...positions].sort((a, b) => a - b), positions, '指名順序需為架構→邏輯→資料→時程');
|
|
});
|
|
|
|
test('正本明令一次只問一題', () => {
|
|
assert.match(prompt, /一次問一題/);
|
|
assert.match(prompt, /不要一次丟出/);
|
|
});
|
|
|
|
test('正本規定每題固定兩個選項:建議(含理由)與手動輸入', () => {
|
|
assert.match(prompt, /\*\*建議\*\*/);
|
|
assert.match(prompt, /理由/);
|
|
assert.match(prompt, /\*\*手動輸入\*\*/);
|
|
assert.match(prompt, /不被選項限制/);
|
|
});
|
|
|
|
test('正本要求前一類問完才進下一類', () => {
|
|
assert.match(prompt, /前一類的問題全部清空才進入下一類/);
|
|
});
|
|
|
|
test('正本規定最後輸出共識摘要,且摘要只印不寫', () => {
|
|
assert.match(prompt, /共識摘要/);
|
|
assert.match(prompt, /只印在終端/);
|
|
assert.match(prompt, /不寫回議題/);
|
|
});
|
|
|
|
test('正本把「共識摘要之前不寫入」寫成明確邊界', () => {
|
|
const boundary = prompt.slice(prompt.indexOf('## 邊界'));
|
|
assert.match(boundary, /共識摘要之前不對 Gitea 產生任何寫入/);
|
|
assert.match(boundary, /不建議題/);
|
|
assert.match(boundary, /不留留言/);
|
|
});
|
|
|
|
test('第一段在共識摘要之前不叫用任何寫入型腳本', () => {
|
|
const analysis = prompt.slice(prompt.indexOf('## 第一段'), prompt.indexOf('## 第二段'));
|
|
for (const writer of ['issue-create', 'issue-update', 'issue-link', 'project-add', 'timer']) {
|
|
assert.equal(analysis.includes(writer), false, `第一段不該出現寫入型腳本 ${writer}`);
|
|
}
|
|
});
|
|
|
|
test('正本要求先看未處理留言數,不是 0 就提示先整併', () => {
|
|
assert.match(prompt, /未處理留言數/);
|
|
assert.match(prompt, /sdlc-sync/);
|
|
assert.match(prompt, /先停下來|先整併/);
|
|
});
|
|
|
|
test('正本指名由 issue-extract 讀議題,而不是自己讀全文', () => {
|
|
assert.match(prompt, /issue-extract/);
|
|
assert.match(prompt, /不必再讀整份議題全文/);
|
|
});
|
|
|
|
test('正本要求能自己查證的就不要拿去問使用者', () => {
|
|
assert.match(prompt, /能在程式碼裡查證的就自己去查/);
|
|
});
|
|
|
|
test('時程清單交代了「這階段還沒有工作包」該怎麼估', () => {
|
|
// 相依鏈最長路徑預設了一份拆法,而分析階段還沒有工作包可依
|
|
assert.match(readReference('feasibility-schedule'), /暫定拆法/);
|
|
assert.match(readReference('feasibility-schedule'), /還沒有工作包/);
|
|
});
|