Skip to content

Commit 8222e7f

Browse files
committed
docs(plans): autoReason 改为捕获整行再清洗
原正则 [^\\n*]+ 直接卡在 * 上,而本仓大量 @ai-context 行以 **加粗** 开头(如 @ai-context **域图标**几何(9 个):…),会一格都捕获不到,使 45 条自动理由全部退化成占位符。改为捕获整行再去掉块注释收尾与加粗标记。
1 parent b1545e8 commit 8222e7f

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎docs/superpowers/plans/2026-09-11-frontend-redesign-batch0c1-line-limit-governance.md‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,16 @@ function parseReasons() {
391391
/** 取该文件 `@ai-context` 的首行要点,作为自动补登时的理由 */
392392
function autoReason(absPath) {
393393
const src = readFileSync(absPath, 'utf8');
394-
const m = /@ai-context[::]?\s*([^\n*]+)/.exec(src);
394+
// 捕获**整行**再清洗,而不是用 `[^\n*]+` 直接卡在 `*` 上 —— 本仓大量 `@ai-context` 行以
395+
// `**加粗**` 开头(如 `@ai-context **域图标**几何(9 个):…`),卡 `*` 会**一格都捕获不到**,
396+
// 使 45 条自动理由全部退化成占位符。
397+
const m = /@ai-context[::]?\s*([^\n]+)/.exec(src);
395398
if (!m) return '(待补理由:本条目由生成器补登)';
396-
return `${m[1].trim()}(自动摘取,待细化)`;
399+
const text = m[1]
400+
.replace(/\*\/\s*$/, '') // 单行块注释的收尾 `*/`
401+
.replace(/\*\*/g, '') // 加粗标记
402+
.trim();
403+
return text ? `${text}(自动摘取,待细化)` : '(待补理由:本条目由生成器补登)';
397404
}
398405

399406
/** 逐字保留「已拆分 / 登记移除记录」整节 */

0 commit comments

Comments
 (0)