fix(parsers): 恢复中英文双语解析,修复中文规范无法校验的回归 (#31)#32
Merged
studyzy merged 1 commit intoJul 13, 2026
Conversation
合并上游 v1.5.0 后,解析/校验层退回为仅匹配英文关键字,导致中文标题的 spec/change 解析出 0 个需求,无法 validate / list / archive(studyzy#31)。 按 1.4.1 的双语逻辑恢复匹配层(仅补匹配,不改现有中文提示文案): - markdown-parser:目的/需求/为什么/变更内容 章节回退;中文 delta 操作识别 (其中把 1.4.1 过宽的裸 `新` 收窄为 `新增|新建`,避免 更新/刷新 被误判为 ADDED) - requirement-blocks:`### 需求:`(含全角冒号 `:`)、`## 需求`、中文 delta 章节等价映射 - change-parser:中文 delta 章节与 FROM/TO 重命名双语匹配 - specs-apply:归档/应用时修改需求头的双语匹配 - base.schema / validator:需求关键字接受 `必须`/`禁止` 新建章节默认标题仍为英文 `## Requirements` 以兼容骨架生成器与既有测试。 新增 test/core/parsers/chinese-bilingual.test.ts(13 用例)覆盖回归。 Closes studyzy#31 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
合并上游 v1.5.0 后,解析/校验层退回为仅匹配英文关键字,导致中文标题的 spec/change 解析出 0 个需求,无法 validate / list / archive —— 即 #31。
根因:v1.5.0 合并后重做汉化时,只翻译了面向用户的提示文案,漏掉了 1.4.1 里的中英文双语匹配逻辑,结果结构关键字匹配退回成"仅英文"。
修复
按 1.4.1 的双语逻辑恢复匹配层(仅补匹配逻辑,不改现有中文提示文案):
parsers/markdown-parser.ts目的/需求/为什么/变更内容章节回退;中文 delta 操作识别(并把 1.4.1 过宽的裸新收窄为新增|新建,避免更新/刷新被误判为 ADDED)parsers/requirement-blocks.ts### 需求:(含全角冒号:)、## 需求;delta 章节中文↔英文等价映射;项目符号 / FROM·TO 重命名双语parsers/change-parser.tsspecs-apply.tsschemas/base.schema.ts·validation/validator.ts必须/禁止(连同SHALL/MUST)刻意保留:提示文案不改(既有测试对其精确断言);新建章节默认标题仍为英文
## Requirements(兼容骨架生成器与既有测试);已存在的## 需求标题会被正确识别并原样保留。测试
新增
test/core/parsers/chinese-bilingual.test.ts(13 用例):纯中文 spec/change 解析、全角冒号、中文 delta 章节、必须/禁止关键字、validateSpecContent/validateChangeDeltaSpecs端到端中文校验。本地全量 1798 用例通过,tsc --noEmit与eslint src/均通过。Closes #31