refactor(issue-body): 工作包的歸屬判準收成一個函式

wp-extract 與 wp-list 都在問「這顆工作包掛在哪顆需求底下」。規則寫兩份,
某天只會有一邊被改到,而分岔的樣子是「清單裡看得到、抽取卻說不是」。
順手把測試裡兩種取段落的寫法統一,並刪掉沒有人傳過的參數。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-17 18:19:33 +08:00
co-authored by Claude Opus 5
parent a5f36ed14c
commit 03ce382220
5 changed files with 24 additions and 11 deletions
+2 -2
View File
@@ -216,7 +216,7 @@ test('一次問一題,選項含手動輸入', () => {
});
test('該問的情況有列舉,不是一句「不確定就問」', () => {
const section = steps.slice(steps.indexOf('## 6.'), steps.indexOf('## 7.'));
const section = step('## 6.', '## 7.');
const bullets = section.match(/^- /gm) ?? [];
assert.ok(bullets.length >= 3, `該問的情況要列得出來,只找到 ${bullets.length} 條`);
assert.match(section, /推了新 commit/, '位置對不上是最常見的一種,要點名');
@@ -257,7 +257,7 @@ test('寫入前要求先試跑', () => {
// ── 摘要 ───────────────────────────────────────────────────────────
test('摘要要逐則列出,並單獨點出沒有記號的那幾則', () => {
const section = steps.slice(steps.indexOf('## 8.'));
const section = steps.slice(steps.indexOf('## 8.')); // 最後一步,到結尾為止
assert.match(section, /逐則一行/);
assert.match(section, /沒有留下記號的那幾則/);
assert.match(section, /以為它們被跳過/, '要說出為什麼得單獨列');
+2 -2
View File
@@ -54,11 +54,11 @@ function routes(issues, overrides = {}) {
});
}
async function run(t, issues, args = []) {
async function run(t, issues) {
const stub = await withStubGitea(t, routes(issues));
const result = await runScript(
'wp-list.js',
['--repo', REPO, '--requirement', String(REQUIREMENT), ...args],
['--repo', REPO, '--requirement', String(REQUIREMENT)],
{ env: envFor(stub) },
);
return { stub, ...result };